471,049 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

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

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
1 5158
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.

Similar topics

reply views Thread by Owen Jenkins | last post: by
2 posts views Thread by Noah Coad [C# MCP] | last post: by
5 posts views Thread by Dennis | last post: by
6 posts views Thread by =?Utf-8?B?bGpsZXZlbmQy?= | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.