468,765 Members | 1,422 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

Splitter control question.

I have a WinForm with three 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.

Mar 22 '07 #1
1 1520
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.

Mar 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Bob (remove 'excise-' to reply) | last post: by
7 posts views Thread by John | last post: by
3 posts views Thread by Andre Loker | last post: by
3 posts views Thread by MFRASER | last post: by
1 post views Thread by Chuck Bowling | last post: by
2 posts views Thread by Mika M | last post: by
1 post views Thread by Dean Slindee | last post: by
4 posts views Thread by Frank | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.