Create a Windows Explorer-like Split Window
.NET 1.0 gave developers the tools they needed to create
split windows of the kind seen in Windows Explorer with the Splitter
control. Unfortunately, creating
these windows wasn't always easy, because it commonly required a
combination of a Splitter
and three
Panel
controls, all of which needed
to be docked in the correct order. If you needed to split a window in
more than one way, the task became even more awkward. Thankfully, .NET
2.0 streamlines the process with a SplitContainer
control.
Note
Split windows are easier than ever now that the SplitContainer control replaces the bare-bones Splitter.
How do I do that?
Essentially, the SplitContainer
control represents two panels
separated by a splitter bar. The user can drag the bar to one side or
another to change the relative amount of space given to each section.
To help signal the availability of this functionality, the mouse
pointer switches from a single- to a double-headed arrow icon when the
user mouses over the splitter bar.
Note
A SplitContainer control is often used when the content in the two panels is related. When the user makes a selection in the first panel, the content in the second is refreshed.
To create a simple interface with the SplitContainer
, you should first decide how
much screen real estate the SplitContainer
will occupy. For example, if
you need to reserve some space below the SplitContainer
, start by docking a Panel
to the bottom of the form. When you
add the SplitContainer ...
Get Visual Basic 2005: A Developer's Notebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.