Splitter


The Splitter control provides the thin strip that users can grab to resize the two panes of a Split?Container. In addition to using the Splitter within a SplitContainer control, you can also use it directly to separate any two other controls.

Visual Basic uses the Dock properties and stacking order of the two controls and the Splitter to determine how the Splitter behaves. To build a simple vertical splitter between two Panel controls, add the first Panel to the form and set its Dock property to Left so that it fills the left side of the form. Next, add a Splitter control. By default, its Dock property is also Left, so it attaches to the right side of the Panel. Finally, add a second Panel control, and set its Dock property to Fill so that it fills the rest of the form. Now, when you drag the Splitter back and forth, Visual Basic adjusts the Panel controls accordingly.

You can use multiple Splitters to separate more than two controls. For example, you could add a Panel with Dock set to Left, a Splitter, another Panel with Dock set to Left, another Splitter, and a final Panel with Dock set to Fill. This would let the user divide the form between the three Panel controls.

The Splitter control uses the controls’ stacking order to determine the order of the controls. When you initially create controls, their stacking order is the same as their order of creation. Unfortunately, if the stacking order changes, the positions of the controls can become very confusing very quickly. In some cases, it’s easier to delete all of the controls and start over than it is to fix the stacking order.

It’s far easier to use the SplitContainer control than it is to use Splitters directly, so you should use the SplitContainer when you have fairly straightforward needs. Only use Splitters directly if you need to provide unusual configurations such as dividing a form among three Panel controls.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net