PC Review


Reply
Thread Tools Rate Thread

Docking controls on Windows Forms

 
 
Leon Jollans
Guest
Posts: n/a
 
      4th Sep 2003
I've been having loads of problems with this. Coming from Java I never had
this problem with the LayoutManagers, but it keeps happening in the VS.NET
designer, and I don't know where the issue's coming from.

Say I have a form and place two controls on it - in this instance a
CrystalReportViewer and a Panel. I set the Panel to Dock Right and the
CrystalReportViewer to Dock Fill. Now according to both my Java AWT and
Swing experience the CrystalViewer should Fill the *remaining* space, but it
doesn't, it acts as if the Panel wasn't there at all and fills the entire
form, clipped by the Right docked Panel rather than resizing to meet its
edge.

This is stopping me using splitters correctly too, since DockStyle.Fill
simply refuses to adjust to the remaining space. Other people can do it, and
I've seen tutorials that demonstrate the correct behaviour using the same
method as I am, so what am I doing wrong??

TIA

Leon


 
Reply With Quote
 
 
 
 
Pete
Guest
Posts: n/a
 
      4th Sep 2003
Hi,

Leon Jollans wrote:
> I've been having loads of problems with this. Coming from Java I
> never had this problem with the LayoutManagers, but it keeps
> happening in the VS.NET designer, and I don't know where the issue's
> coming from.


Coming from Java you might benefit from this:

http://tinyurl.com/m8xj

It's not a complete system, but it's a step in the right direction. I've
seen similar work on implementing layout managers in .NET on other sites
too. Try a search if you want to go that way.

> This is stopping me using splitters correctly too, since
> DockStyle.Fill simply refuses to adjust to the remaining space. Other
> people can do it, and I've seen tutorials that demonstrate the
> correct behaviour using the same method as I am, so what am I doing
> wrong??


As I understand matters, you are having z-order problems. Either add
controls in a different order, or use the bringtofront and sendtoback
(probably not quite the right names) to change the order. I think you can
also do SetChildIndex on the parents Controls container.

Hope that helps.

-- Pete


 
Reply With Quote
 
Iulian Ionescu
Guest
Posts: n/a
 
      4th Sep 2003

I believe the correct way is like this:

1) add a control and dock it to the right
2) add a splitter control and dock it to the right too
3) add a second control and dock it fill.

Then you should be able to grab the splitter and actually
change the size of the split...


>-----Original Message-----
>I've been having loads of problems with this. Coming

from Java I never had
>this problem with the LayoutManagers, but it keeps

happening in the VS.NET
>designer, and I don't know where the issue's coming from.
>
>Say I have a form and place two controls on it - in this

instance a
>CrystalReportViewer and a Panel. I set the Panel to Dock

Right and the
>CrystalReportViewer to Dock Fill. Now according to both

my Java AWT and
>Swing experience the CrystalViewer should Fill the

*remaining* space, but it
>doesn't, it acts as if the Panel wasn't there at all and

fills the entire
>form, clipped by the Right docked Panel rather than

resizing to meet its
>edge.
>
>This is stopping me using splitters correctly too, since

DockStyle.Fill
>simply refuses to adjust to the remaining space. Other

people can do it, and
>I've seen tutorials that demonstrate the correct

behaviour using the same
>method as I am, so what am I doing wrong??
>
>TIA
>
>Leon
>
>
>.
>

 
Reply With Quote
 
Stephen
Guest
Posts: n/a
 
      5th Sep 2003
The order in which you create controls is very important in my experience.
Whatever is going to be set to Fill must be created on the form last or else
it doesn't recognize the other controls existence at the time of its
creation. Remember that when you draw controls on a form and set their
properties it just places the code for that in the InitializeComponents()
routine. So if it hits the code for the CrystalViewer before the Panel is
created and placed, it will fill the entire form and the Panel will just go
on top or under it. Let me know if that doesn't help, but it did in my
experience.

Stephen

"Leon Jollans" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've been having loads of problems with this. Coming from Java I never had
> this problem with the LayoutManagers, but it keeps happening in the VS.NET
> designer, and I don't know where the issue's coming from.
>
> Say I have a form and place two controls on it - in this instance a
> CrystalReportViewer and a Panel. I set the Panel to Dock Right and the
> CrystalReportViewer to Dock Fill. Now according to both my Java AWT and
> Swing experience the CrystalViewer should Fill the *remaining* space, but

it
> doesn't, it acts as if the Panel wasn't there at all and fills the entire
> form, clipped by the Right docked Panel rather than resizing to meet its
> edge.
>
> This is stopping me using splitters correctly too, since DockStyle.Fill
> simply refuses to adjust to the remaining space. Other people can do it,

and
> I've seen tutorials that demonstrate the correct behaviour using the same
> method as I am, so what am I doing wrong??
>
> TIA
>
> Leon
>
>



 
Reply With Quote
 
Tom
Guest
Posts: n/a
 
      5th Sep 2003
It's pretty easy when you get used to it. The Z order of the control
determines the docking behavior. When the situation you describe occurs,
right click on the offending control and select "Bring to Front" from the
context menu (or use the Format/Order/Bring to Front menu.)

Tom

"Leon Jollans" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I've been having loads of problems with this. Coming from Java I never had
> this problem with the LayoutManagers, but it keeps happening in the VS.NET
> designer, and I don't know where the issue's coming from.
>
> Say I have a form and place two controls on it - in this instance a
> CrystalReportViewer and a Panel. I set the Panel to Dock Right and the
> CrystalReportViewer to Dock Fill. Now according to both my Java AWT and
> Swing experience the CrystalViewer should Fill the *remaining* space, but

it
> doesn't, it acts as if the Panel wasn't there at all and fills the entire
> form, clipped by the Right docked Panel rather than resizing to meet its
> edge.
>
> This is stopping me using splitters correctly too, since DockStyle.Fill
> simply refuses to adjust to the remaining space. Other people can do it,

and
> I've seen tutorials that demonstrate the correct behaviour using the same
> method as I am, so what am I doing wrong??
>
> TIA
>
> Leon
>
>



 
Reply With Quote
 
Leon Jollans
Guest
Posts: n/a
 
      9th Sep 2003
That link's really useful. thanks!


"Pete" <(E-Mail Removed)> wrote in message
news:_LL5b.5034$(E-Mail Removed)...
> Hi,
>
> Leon Jollans wrote:
> > I've been having loads of problems with this. Coming from Java I
> > never had this problem with the LayoutManagers, but it keeps
> > happening in the VS.NET designer, and I don't know where the issue's
> > coming from.

>
> Coming from Java you might benefit from this:
>
> http://tinyurl.com/m8xj
>
> It's not a complete system, but it's a step in the right direction. I've
> seen similar work on implementing layout managers in .NET on other sites
> too. Try a search if you want to go that way.
>
> > This is stopping me using splitters correctly too, since
> > DockStyle.Fill simply refuses to adjust to the remaining space. Other
> > people can do it, and I've seen tutorials that demonstrate the
> > correct behaviour using the same method as I am, so what am I doing
> > wrong??

>
> As I understand matters, you are having z-order problems. Either add
> controls in a different order, or use the bringtofront and sendtoback
> (probably not quite the right names) to change the order. I think you can
> also do SetChildIndex on the parents Controls container.
>
> Hope that helps.
>
> -- Pete
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Windows Forms Controls as ActiveX controls =?Utf-8?B?bGFyc2dyZWdlcnNlbg==?= Microsoft Dot NET 2 18th Oct 2007 10:01 AM
Docking of controls Tor Inge Rislaa Microsoft VB .NET 4 9th May 2005 03:26 PM
Controls and Docking Daniele Fornaciari Microsoft Dot NET Framework Forms 1 21st Mar 2005 09:16 PM
Re: Docking of controls... Armin Zingler Microsoft VB .NET 0 27th Aug 2003 06:39 PM
Re: Docking of controls... Vijay Microsoft VB .NET 0 27th Aug 2003 06:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:51 PM.