MenuItem.Break 属性

定义

获取或设置一个值,通过该值指示是将该项放在新行上(对于添加到 MainMenu 对象的菜单项),还是放在新列中(对于 ContextMenu 中显示的菜单项或子菜单项)。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).

public:
 property bool Break { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(false)]
public bool Break { get; set; }
member this.Break : bool with get, set
Public Property Break As Boolean

属性值

如果菜单项放在新行上或新列中,则为 true;如果菜单项保持在其默认位置,则为 falsetrue 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. 默认值为 falseThe default is false.

属性

示例

下面的代码示例创建一个菜单,该菜单的顶部行上有两个顶级菜单项,最后一行上有一个菜单项。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 = gcnew MenuItem( "&File" );
      MenuItem^ menuItem2 = gcnew MenuItem( "&Options" );
      MenuItem^ menuItem3 = gcnew 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.Break = true;
}
  
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

注解

您可以使用 "Break" 属性来创建一个菜单,其中每个菜单都在每个水平相邻放置,而不是在垂直列表中。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.

适用于

另请参阅