By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,933 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,933 IT Pros & Developers. It's quick & easy.

How do I dynamically resize portion of form with WinForms splitter control on it.

P: n/a
I have a simple WinForm with a WinForms splitter down the middle. I
would like to make it so when the user clicks on a button inside the
left portion of the screen (the panel to the splitters left) that
portion of the form is reduced in size by about 90% (I want to shrink
this area of the of the form).

The splitter doesn't appear to have any methods for programmatic
resizing, I tried changing it's width settings and the splitter moved
without moving the controls inside it.

Mar 9 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Mar 9, 1:00 pm, "JDeats" <Jeremy.De...@gmail.comwrote:
I have a simple WinForm with a WinForms splitter down the middle. I
would like to make it so when the user clicks on a button inside the
left portion of the screen (the panel to the splitters left) that
portion of the form is reduced in size by about 90% (I want to shrink
this area of the of the form).

The splitter doesn't appear to have any methods for programmatic
resizing, I tried changing it's width settings and the splitter moved
without moving the controls inside it.
To resize a Splitter you can use the Splitters "SplitPosition"
attribute. You can increase or decrease this value to move the
splitter different directions depending on how it is docked to your
form. If you want to reduce a panel that is controlled by a splitter
by 90% I would do the following.

splitter1.SplitPosition = (int)((double)splitter1.SplitPosition * .1);

and that will reduce it by 90% assuming this isn't less than the
MinSize of the splitter. Let me know if you have any problems using
this code.

~ Justin Creasy
www.immergetech.com
www.immergecomm.com

Mar 9 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.