Splitter control (winforms)

Dmitry Makovetskiyd picture Dmitry Makovetskiyd · Apr 23, 2011 · Viewed 17.3k times · Source

I want the user to adjust the splitter... I have two sides in the winform: one shows the people and the other shows the details about them. I want the user to be able to move the spliter, to adjust how much he wants of the each side of the form to be seen.

How do i achieve that?

Answer

Thomas Zoechling picture Thomas Zoechling · Apr 23, 2011

Use the SplitContainer class:
http://msdn.microsoft.com/en-us/library/system.windows.forms.splitcontainer.aspx

Move your "People" List in the left splitcontainer panel and the detail view into the right panel. Be careful when Cut & Pasting your controls. VS2008 looses all event handlers when moving control to the clipboard. (Don't know about VS2010).

Split containers allow you to set a fixed panel - a panel that does not auto-resize when the view bounds change. This is probably your "People" list.