R
RMZ
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.
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.