JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Creating Toolbars

After you've added a toolbar to a Windows form, you can dock it on any edge you like-by default, the Dock property is set to Top, but you can set it to Top, Bottom, Fill, or whatever you prefer. To actually add the buttons to a toolbar at design time, click the Buttons property at design time, which opens the ToolBarButton Collection Editor you see in Figure 10.18. You can add buttons to the toolbar as with the other editors we've seen (see "Creating Tree Views" and "Creating List Views" earlier in this chapter)-just click the Add button to add a new button to the toolbar, and Remove to remove a button.

Click To expand
Figure 10.18: The ToolBarButton Collection Editor.

You also can set the text in a button with the Text property in the ToolBarButton Collection Editor, the image from an image list to use in a button with the ImageIndex property, and the style of the button with the Style property, which can take these values:

  • PushButton- A normal push button.

  • ToggleButton- A toggle button that toggles between up and down.

  • Separator- A small space between other buttons, used to space and group buttons.

  • DropDownButton- A button that can display a drop-down menu.

I've added one of each of these types of buttons to the toolbar in the ToolBars example on the CD-ROM, which you see operating in Figure 10.4. How do you make this toolbar do something? See the next topic.

Previous Section Next Section

JavaScript Editor Free JavaScript Editor     JavaScript Editor