This documentation is archived and is not being maintained.

MenuItem.Break Property

Gets or sets a value indicating whether the item is placed on a new line (for a menu item added to a MainMenu object) or in a new column (for a menu item or submenu item displayed in a ContextMenu).

[Visual Basic]
Public Property Break As Boolean
[C#]
public bool Break {get; set;}
[C++]
public: __property bool get_Break();
public: __property void set_Break(bool);
[JScript]
public function get Break() : Boolean;
public function set Break(Boolean);

Property Value

true to place the menu item on a new line or in a new column; false to leave the menu item in its default placement. The default is false.

Remarks

You can use the Break property to create a menu where each menu is placed next to each other horizontally instead of in a vertical list. You can also use this property to create a menu bar that contains multiple rows of top-level menu items.

Example

[Visual Basic, C#, C++] The following example creates a menu with two top-level menu items on the top row and one menu item on the bottom row.

[Visual Basic] 
Public Sub CreateMyMenus()
    ' Create three top-level menu items.
    Dim menuItem1 As New MenuItem("&File")
    Dim menuItem2 As New MenuItem("&Options")
    Dim menuItem3 As New MenuItem("&Edit")
    ' Place the "Edit" menu on a new line in the menu bar.
    menuItem3.Break = True
End Sub


[C#] 
public void CreateMyMenus()
{
   // Create three top-level menu items.
   MenuItem menuItem1 = new MenuItem("&File");
   MenuItem menuItem2 = new MenuItem("&Options");
   MenuItem menuItem3 = new MenuItem("&Edit");
   // Place the "Edit" menu on a new line in the menu bar.
   menuItem3.Break = true;
}
  

[C++] 
public:
 void CreateMyMenus()
 {
    // Create three top-level menu items.
    MenuItem* menuItem1 = new MenuItem(S"&File");
    MenuItem* menuItem2 = new MenuItem(S"&Options");
    MenuItem* menuItem3 = new MenuItem(S"&Edit");
    // Place the "Edit" menu on a new line in the menu bar.
    menuItem3->Break = true;
 }
   

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

MenuItem Class | MenuItem Members | System.Windows.Forms Namespace | BarBreak

Show: