MenuItem.MergeType 属性

定义

获取或设置一个值,通过该值指示该菜单项的菜单与另一个菜单合并时该菜单项的行为。Gets or sets a value indicating the behavior of this menu item when its menu is merged with another.

public:
 property System::Windows::Forms::MenuMerge MergeType { System::Windows::Forms::MenuMerge get(); void set(System::Windows::Forms::MenuMerge value); };
public System.Windows.Forms.MenuMerge MergeType { get; set; }
member this.MergeType : System.Windows.Forms.MenuMerge with get, set
Public Property MergeType As MenuMerge

属性值

一个 MenuMerge 值,该值表示菜单项的合并类型。A MenuMerge value that represents the menu item's merge type.

异常

分配的值不是 MenuMerge 值之一。The assigned value is not one of the MenuMerge values.

示例

下面的代码示例使用指定的 MergeTypeMergeOrder 创建 MenuItem,以便将菜单项添加到第一个位置的合并菜单。The following code example creates a MenuItem with the MergeType and MergeOrder specified so that the menu item is added to the merged menu at first position.

public:
   void InitMyFileMenu()
   {
      // Set the MergeType to Add so that the menu item is added to the merged menu.
      menuItem1->MergeType = MenuMerge::Add;
      // Set the MergeOrder to 1 so that this menu item is placed lower in the merged menu order.
      menuItem1->MergeOrder = 1;
   }
public void InitMyFileMenu()
{
   // Set the MergeType to Add so that the menu item is added to the merged menu.
   menuItem1.MergeType = MenuMerge.Add;
   // Set the MergeOrder to 1 so that this menu item is placed lower in the merged menu order.
   menuItem1.MergeOrder = 1;
}

Public Sub InitMyFileMenu()
    ' Set the MergeType to Add so that the menu item is added to the merged menu.
    menuItem1.MergeType = MenuMerge.Add
    ' Set the MergeOrder to 1 so that this menu item is placed lower in the merged menu order.
    menuItem1.MergeOrder = 1
End Sub

注解

菜单项的合并类型指示菜单项与另一个要合并的菜单项的合并顺序相同的行为方式。The merge type of a menu item indicates how the menu item behaves when it has the same merge order as another menu item being merged. 您可以根据两个或更多现有菜单,使用合并菜单来创建合并菜单。You can use merged menus to create a consolidated menu based on two or more existing menus.

适用于

另请参阅