MenuItem.MergeType 属性

定义

获取或设置一个值,通过该值指示该菜单项的菜单与另一个菜单合并时该菜单项的行为。

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 值,该值表示菜单项的合并类型。

例外

分配的值不是 MenuMerge 值之一。

示例

下面的代码示例创建一个 MenuItem 具有 MergeType 指定 和 MergeOrder 的 ,以便将菜单项添加到合并菜单的第一个位置。

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

注解

菜单项的合并类型指示菜单项与要合并的另一个菜单项具有相同的合并顺序时该菜单项的行为方式。 可以使用合并菜单基于两个或多个现有菜单创建合并菜单。

适用于

另请参阅