Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / March 2007

Tip: Looking for answers? Try searching our database.

question about using multiple splitter controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RMZ - 22 Mar 2007 06:15 GMT
I have a WinForm with two Splitter controls on it. The form divides
up in this order: Tab Control (docked to the left): Splitter1:
RichTextBox (docked to the left): Splitter2

After Splliter2 there is some empty space on the form where I have a
few button controls.

When the app starts the form is 800x600, but I need to give the user
the ability to maximize and to resize the form to whatever size they
like. When the occurs I need the splitters to adjust to a percentage
of the screen area so that they remain proportionate regardless of
size. Except I need to keep the area to the far right of the screen
(where the buttons reside) fixed at 120 pixels in length, regardless
of what size the Window is.

I would think trapping on the ClientSizeChanged and doing something
like this would work:

private void frmMyForm_ClientSizeChanged(object sender, EventArgs e)
{
   Splitter2.SplitPosition = this.Width - 120;

}

where "this" is the current instance of the Form, however this does
not work. If I maximize the form the area to the right is considerably
larger than 120 pixels and it doesn't seem to ever follow this rule.
ClayB - 22 Mar 2007 10:42 GMT
Since you have multiple splitters docked left, the position of the
second splitter from the left is determined by the position of the
first splitter from the left and the size of the control (say panel1)
between the first splitter (this.splitter1) and the second splitter.
So, if you want the second splitter (this.splitter2) to be always 120
pixels from the right side of the form, try this code:

             this.panel1.Width = this.Width -
this.splitter1.SplitPosition - 120;

This should size the control (panel1) to be exactly the size to
position splitter2 120 units from the right edge of the form.

========================
Clay Burch
Syncfusion, Inc.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.