Adding Separator Bars to Menus

It can be useful to add separator bars to menus to set groups of menu options apart from each other. You can add a separator to any sub-menu at design time by choosing Separator from the drop-down box in the menu item design interface, as shown in Figure 4-4.

Figure 4-4 Choosing a separator in the menu item design interface

Note that if you want to add a separator to a top-level menu, you must do so programmatically by creating a new instance of the ToolStripSeparator control and inserting it into the correct location in the MenuStrip.Items collection, as shown here:

Dim aSeparator As New ToolStripSeparator MenuStrip1.Items.Insert(1, aSeparator)

ToolStripSeparator aSeparator = new Too1StripSeparator(); menuStrip1.Items.Insert(1, aSeparator);

Was this article helpful?

0 0

Post a comment