Export (0) Print
Expand All

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).

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public bool Break { get; set; }
/** @property */
public boolean get_Break ()

/** @property */
public void set_Break (boolean value)

public function get Break () : boolean

public function set Break (value : boolean)

Property Value

true if the menu item is placed on a new line or in a new column; false if the menu item is left in its default placement. The default is false.

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.

The following code example creates a menu with two top-level menu items on the top row and one menu item on the bottom row.

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;
}
  

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.set_Break(true);
} //CreateMyMenus

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft