PC Review


Reply
Thread Tools Rate Thread

Docking 2 controls to share space

 
 
Scott Hodson
Guest
Posts: n/a
 
      5th Sep 2003
I have two data grids, 1 on the left of a form and 1 on the right side, and
as I expand the size of the form I would like them both to fill the new
space, each grid always taking up 50% of the available space.

I tried this setting both of their Dock properties to Fill but they both
take up 100% of the form. I tried setting the anchoring differently as well
but to no avail. I'm not sure how to make these two grids equally share the
available screen space as the size of the form changes.


 
Reply With Quote
 
 
 
 
Bob Powell [MVP]
Guest
Posts: n/a
 
      5th Sep 2003
Override the Form.Layout event and reposition your controls.

protected override void OnLayout(LayoutEventArgs levent)

{

this.dataGrid1.Location=new Point(0,0);

this.dataGrid1.Size=new
Size(this.ClientSize.Width/2,this.ClientSize.Height);

this.dataGrid2.Location=new Point(this.ClientSize.Width/2,0);

this.dataGrid2.Size=new
Size(this.ClientSize.Width/2,this.ClientSize.Height);

base.OnLayout (levent);

}


--
Bob Powell [MVP]
C#, System.Drawing

ANNOUNCING: Well Formed.
The monthy electronic magazine for
Windows Forms and GDI+ engineers
http://www.bobpowell.net/wellformed.htm

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm


"Scott Hodson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have two data grids, 1 on the left of a form and 1 on the right side,

and
> as I expand the size of the form I would like them both to fill the new
> space, each grid always taking up 50% of the available space.
>
> I tried this setting both of their Dock properties to Fill but they both
> take up 100% of the form. I tried setting the anchoring differently as

well
> but to no avail. I'm not sure how to make these two grids equally share

the
> available screen space as the size of the form changes.
>
>



 
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
HOW-TO: Controls Share Same Space? Martijn Mulder Microsoft C# .NET 0 6th Jan 2009 07:30 PM
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:50 PM.