JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating Splitter Controls

As discussed in the In Depth section of this chapter, splitters are relatively simple controls; you use them to let the user resize controls at run time. You can see the Splitters example from the CD-ROM at work in Figure 8.2.

You can enable or disable the splitter with the Enabled property, set the cursor that appears with the splitter with the Cursor property (for vertical splitters, the default is VSplit, for horizontal splitters, it's HSplit; see "Setting the Mouse Pointer in Controls" in Chapter 5 for more information). You also can set the BorderStyle to None (the default), Fixed, or Fixed3D. Also, note that the MinSize property specifies the minimum size of the control you're resizing.

As discussed in the In Depth section of this chapter, you create a splitter at design time. First, you dock the control you want to use the splitter with to an edge of its container, then add the splitter and dock it the same way, as you see in Figure 8.11 (the splitter is the dotted double line in that figure). The splitter automatically works with the control that immediately precedes it in the docking order, which in this case is a text box (with its MultiLine property set to True so it can extend from the top of the form to the bottom).

Click To expand
Figure 8.11: Creating a splitter.

When you run the Splitters example, you can use the splitter to resize the text box, as you see in Figure 8.2. Note the cursor in that figure, which is the VSplit cursor, indicates that you can resize the related control.

Of course, you may not want your control to extend from the top to the bottom of your form, in which case you can dock it in a container control. For example, take a look at Figure 8.12; here, I've docked a multiline text box and a splitter inside a borderless Panel control, which acts as a container.

Figure 8.12: Using a splitter inside a Panel container.

Related solutions:

Found on page:

Setting the Mouse Pointer in Controls


Creating Panels


Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor