MenuItem 생성자

정의

MenuItem 클래스의 새 인스턴스를 초기화합니다.

오버로드

MenuItem()

캡션이 비어 있는 MenuItem을 초기화합니다.

MenuItem(String)

메뉴 항목의 지정된 캡션을 사용하여 MenuItem 클래스의 새 인스턴스를 초기화합니다.

MenuItem(String, EventHandler)

메뉴 항목의 Click 이벤트에 대한 이벤트 처리기 및 지정된 캡션을 사용하여 클래스의 새 인스턴스를 초기화합니다.

MenuItem(String, MenuItem[])

메뉴 항목의 정의된 캡션 및 하위 메뉴 항목의 배열을 사용하여 클래스의 새 인스턴스를 초기화합니다.

MenuItem(String, EventHandler, Shortcut)

메뉴 항목의 지정된 캡션, 이벤트 처리기 및 관련된 바로 가기 키를 사용하여 클래스의 새 인스턴스를 초기화합니다.

MenuItem(MenuMerge, Int32, Shortcut, String, EventHandler, EventHandler, EventHandler, MenuItem[])

메뉴 항목의 지정된 캡션, MenuItem, ClickSelect 이벤트에 대해 지정된 이벤트 처리기, 바로 가기 키, 병합 유형 및 지정된 순서를 사용하여 Popup 클래스의 새 인스턴스를 초기화합니다.

MenuItem()

캡션이 비어 있는 MenuItem을 초기화합니다.

public:
 MenuItem();
public MenuItem ();
Public Sub New ()

예제

다음 코드 예제에서는 MenuItem 생성자의이 버전을 사용 합니다.

public:
   void CreateMyMenu()
   {
      // Create an empty menu item object.
      MenuItem^ menuItem1 = gcnew MenuItem;
      // Intialize the menu item using the parameterless version of the constructor.
      // Set the caption of the menu item.
      menuItem1->Text = "&File";
   }
public void CreateMyMenu()
{
   // Create an empty menu item object.
   MenuItem menuItem1 = new MenuItem();
   // Intialize the menu item using the parameterless version of the constructor.
   // Set the caption of the menu item.
   menuItem1.Text = "&File";
}
Public Sub CreateMyMenu()
    ' Create an empty menu item object.
    Dim menuItem1 As New MenuItem()
    ' Intialize the menu item using the parameterless version of the constructor.
    ' Set the caption of the menu item.
    menuItem1.Text = "&File"
End Sub

설명

빈 값을 만든 후 MenuItem 사용이 생성자를 사용할 수 있습니다의 메서드와 속성을 MenuItem 의 모양 및 동작을 지정 하는 클래스에 MenuItem입니다.

적용 대상

MenuItem(String)

메뉴 항목의 지정된 캡션을 사용하여 MenuItem 클래스의 새 인스턴스를 초기화합니다.

public:
 MenuItem(System::String ^ text);
public MenuItem (string text);
new System.Windows.Forms.MenuItem : string -> System.Windows.Forms.MenuItem
Public Sub New (text As String)

매개 변수

text
String

메뉴 항목의 캡션입니다.

예제

다음 코드 예제는 MenuItem 는 생성 된 시간에 메뉴 항목의 캡션을 지정 하는 합니다.

public:
   void CreateMyMenus()
   {
      // Create an instance of a MenuItem with a specified caption.
      menuItem1 = gcnew MenuItem( "&File" );
   }
public void CreateMyMenus()
{
   // Create an instance of a MenuItem with a specified caption.
   menuItem1 = new MenuItem("&File");
}
Public Sub CreateMyMenus()
    ' Create an instance of a MenuItem with a specified caption.
    menuItem1 = New MenuItem("&File")
End Sub

설명

메뉴 항목에 대 한 캡션을 지정 하는 경우는 text 매개 변수를 지정할 수도 있습니다 선택키가 액세스 키로 사용할 문자의 앞 '에 &' 문자를 배치 하 여 합니다. 예를 들어 "파일"에서 "F"가 선택 키를 지정 하려면 사용자는 표시 된 메뉴 항목에 대 한 캡션을 지정 "& 파일"입니다. 메뉴에 대 한 키보드 탐색을 위해이 기능을 사용할 수 있습니다.

설정 합니다 text 매개 변수를 "-" 메뉴 항목 (가로 선) 구분 기호 대신 표준 메뉴 항목을 표시 하면 됩니다.

적용 대상

MenuItem(String, EventHandler)

메뉴 항목의 Click 이벤트에 대한 이벤트 처리기 및 지정된 캡션을 사용하여 클래스의 새 인스턴스를 초기화합니다.

public:
 MenuItem(System::String ^ text, EventHandler ^ onClick);
public MenuItem (string text, EventHandler onClick);
new System.Windows.Forms.MenuItem : string * EventHandler -> System.Windows.Forms.MenuItem
Public Sub New (text As String, onClick As EventHandler)

매개 변수

text
String

메뉴 항목의 캡션입니다.

onClick
EventHandler

이 메뉴 항목의 EventHandler 이벤트를 처리하는 Click입니다.

예제

다음 코드 예제에서는 MenuItem 지정 된 캡션 사용 하 여 개체 및 EventHandler 처리할 이벤트 처리기에 연결 된 대리자는 Click 메뉴 항목에 대 한 이벤트입니다.

public:
   void CreateMyMenuItem()
   {
      // Create an instance of MenuItem with caption and an event handler
      MenuItem^ menuItem1 = gcnew MenuItem( "&New",gcnew System::EventHandler(
         this, &Form1::MenuItem1_Click ) );
   }

private:
   // This method is an event handler for menuItem1 to use when connecting its event handler.
   void MenuItem1_Click( Object^ sender, System::EventArgs^ e )
   {
      // Code goes here that handles the Click event.
   }
public void CreateMyMenuItem()
{
   // Create an instance of MenuItem with caption and an event handler
   MenuItem menuItem1 = new MenuItem("&New", new System.EventHandler(this.MenuItem1_Click));
}

// This method is an event handler for menuItem1 to use when connecting its event handler.
private void MenuItem1_Click(Object sender, System.EventArgs e) 
{
   // Code goes here that handles the Click event.
}
Public Sub CreateMyMenuItem()
    ' Create an instance of MenuItem with caption and an event 
    ' handler
    Dim MenuItem1 As New MenuItem("&New", New _
        System.EventHandler(AddressOf Me.MenuItem1_Click))
End Sub
' This method is an event handler for MenuItem1 to use when 
' connecting its event handler.
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal _
    e as System.EventArgs)
    ' Code goes here that handles the Click event.
End Sub

설명

메뉴 항목에 대 한 캡션을 지정 하는 경우는 text 매개 변수를 지정할 수도 있습니다 선택키가 앞에 '&' 선택 키로 사용할 문자를 배치 하 여 합니다. 예를 들어 "파일"에서 "F"가 선택 키를 지정 하려면 사용자는 표시 된 메뉴 항목에 대 한 캡션을 지정 "& 파일"입니다. 메뉴에 대 한 키보드 탐색을 위해이 기능을 사용할 수 있습니다.

설정 합니다 text 매개 변수를 "-" 메뉴 항목 (가로 선) 구분 기호 대신 표준 메뉴 항목을 표시 하면 됩니다.

처리 하는 대리자를 지정 하려면이 생성자를 사용할 수는 또한는 Click 만들어지는 메뉴 항목에 대 한 이벤트입니다. 합니다 EventHandler 이 생성자에 전달 하는 처리할 수 있는 이벤트 처리기를 호출 하도록 구성 되어야 합니다는 Click 이벤트입니다. 이벤트를 처리 하는 방법은 참조 하세요 이벤트 처리 및 발생합니다.

적용 대상

MenuItem(String, MenuItem[])

메뉴 항목의 정의된 캡션 및 하위 메뉴 항목의 배열을 사용하여 클래스의 새 인스턴스를 초기화합니다.

public:
 MenuItem(System::String ^ text, cli::array <System::Windows::Forms::MenuItem ^> ^ items);
public MenuItem (string text, System.Windows.Forms.MenuItem[] items);
new System.Windows.Forms.MenuItem : string * System.Windows.Forms.MenuItem[] -> System.Windows.Forms.MenuItem
Public Sub New (text As String, items As MenuItem())

매개 변수

text
String

메뉴 항목의 캡션입니다.

items
MenuItem[]

이 메뉴 항목의 하위 메뉴 항목이 들어 있는 MenuItem 개체의 배열입니다.

예제

다음 코드 예제에에서 개체를 만듭니다는 지정 된 캡션, 이벤트를 처리 하는 메서드에 연결 된 이벤트 처리기를 사용 하 여 각 메뉴 항목 하위 메뉴 항목의 배열입니다.

public:
   void CreateMyMenuItem()
   {
      // submenu item array.
      array<MenuItem^>^ subMenus = gcnew array<MenuItem^>(3);
      // Create three menu items to add to the submenu item array.
      MenuItem^ subMenuItem1 = gcnew MenuItem( "Red" );
      MenuItem^ subMenuItem2 = gcnew MenuItem( "Blue" );
      MenuItem^ subMenuItem3 = gcnew MenuItem( "Green" );
      // Add the submenu items to the array.
      subMenus[ 0 ] = subMenuItem1;
      subMenus[ 1 ] = subMenuItem2;
      subMenus[ 2 ] = subMenuItem3;
      // Create an instance of a MenuItem with caption and an array of submenu
      // items specified.
      MenuItem^ MenuItem1 = gcnew MenuItem( "&Colors",subMenus );
   }
public void CreateMyMenuItem()
{
   // submenu item array.
   MenuItem[] subMenus = new MenuItem[3];
   // Create three menu items to add to the submenu item array.
   MenuItem subMenuItem1 = new MenuItem("Red");
   MenuItem subMenuItem2 = new MenuItem("Blue");
   MenuItem subMenuItem3 = new MenuItem("Green");
   // Add the submenu items to the array.
   subMenus[0] = subMenuItem1;
   subMenus[1] = subMenuItem2;
   subMenus[2] = subMenuItem3;
   // Create an instance of a MenuItem with caption and an array of submenu
   // items specified.
   MenuItem MenuItem1 = new MenuItem("&Colors", subMenus);
}
Public Sub CreateMyMenuItem()
    ' submenu item array.
    Dim subMenus(3) As MenuItem
    ' Create three menu items to add to the submenu item array.
    Dim subMenuItem1 As New MenuItem("Red")
    Dim subMenuItem2 As New MenuItem("Blue")
    Dim subMenuItem3 As New MenuItem("Green")
    ' Add the submenu items to the array.
    subMenus(0) = subMenuItem1
    subMenus(1) = subMenuItem2
    subMenus(2) = subMenuItem3
    ' Create an instance of a MenuItem with caption and an array of submenu
    ' items specified.
    Dim MenuItem1 As New MenuItem("&Colors", subMenus)
End Sub

설명

메뉴 항목에 대 한 캡션을 지정 하는 경우는 text 매개 변수를 지정할 수도 있습니다 선택키가 앞에 '&' 선택 키로 사용할 문자를 배치 하 여 합니다. 예를 들어 "파일"에서 "F"가 선택 키를 지정 하려면 사용자는 표시 된 메뉴 항목에 대 한 캡션을 지정 "& 파일"입니다. 메뉴에 대 한 키보드 탐색을 위해이 기능을 사용할 수 있습니다.

설정 합니다 text 매개 변수를 "-" 메뉴 항목 (가로 선) 구분 기호 대신 표준 메뉴 항목을 표시 하면 됩니다.

items 매개 변수를 사용 하면이 메뉴 항목의 하위 메뉴를 정의할 메뉴 항목의 배열을 할당 합니다. 배열의 각 항목에 할당 된 메뉴 항목의 배열을 가질 수도 있습니다. 이 옵션을 사용 하면 전체 메뉴 구조를 만들고 메뉴 항목에 대 한 생성자에 할당할 수 있습니다.

이벤트를 처리 하는 방법은 참조 하세요 이벤트 처리 및 발생합니다.

적용 대상

MenuItem(String, EventHandler, Shortcut)

메뉴 항목의 지정된 캡션, 이벤트 처리기 및 관련된 바로 가기 키를 사용하여 클래스의 새 인스턴스를 초기화합니다.

public:
 MenuItem(System::String ^ text, EventHandler ^ onClick, System::Windows::Forms::Shortcut shortcut);
public MenuItem (string text, EventHandler onClick, System.Windows.Forms.Shortcut shortcut);
new System.Windows.Forms.MenuItem : string * EventHandler * System.Windows.Forms.Shortcut -> System.Windows.Forms.MenuItem
Public Sub New (text As String, onClick As EventHandler, shortcut As Shortcut)

매개 변수

text
String

메뉴 항목의 캡션입니다.

onClick
EventHandler

이 메뉴 항목의 EventHandler 이벤트를 처리하는 Click입니다.

shortcut
Shortcut

Shortcut 값 중 하나입니다.

예제

다음 코드 예제에서는 지정 된 캡션, 바로 가기 키 및 메뉴 항목에 대 한 이벤트를 처리 하는 메서드에 연결 된 이벤트 처리기를 사용 하 여 개체를 만듭니다.

public:
   void CreateMyMenuItem()
   {
      // Create a MenuItem with caption, shortcut key, and an event handler
      // specified.
      MenuItem^ MenuItem1 = gcnew MenuItem( "&New",
         gcnew System::EventHandler( this, &Form1::MenuItem1_Click ), Shortcut::CtrlL );
   }

private:
   // The following method is an event handler for menuItem1 to use when
   // connecting the event handler.
   void MenuItem1_Click( Object^ sender, EventArgs^ e )
   {
      // Code goes here that handles the Click event.
   }
public void CreateMyMenuItem()
{
   // Create a MenuItem with caption, shortcut key, and an event handler
   // specified.
   MenuItem MenuItem1 = new MenuItem("&New",
       new System.EventHandler(this.MenuItem1_Click), Shortcut.CtrlL);
}

// The following method is an event handler for menuItem1 to use when
// connecting the event handler.
private void MenuItem1_Click(Object sender, EventArgs e)
{
   // Code goes here that handles the Click event.
}
Public Sub CreateMyMenuItem()
    ' Create a MenuItem with caption, shortcut key, and an event handler
    ' specified.
    Dim MenuItem1 As New MenuItem("&New", _
       New System.EventHandler(AddressOf Me.MenuItem1_Click), Shortcut.CtrlL)
End Sub    
   
' The following method is an event handler for menuItem1 to use when
' connecting the event handler.
Private Sub MenuItem1_Click(sender As Object, e As EventArgs)
    ' Code goes here that handles the Click event.
End Sub

설명

메뉴 항목에 대 한 캡션을 지정 하는 경우는 text 매개 변수를 지정할 수도 있습니다 선택키가 앞에 '&' 선택 키로 사용할 문자를 배치 하 여 합니다. 예를 들어 "파일"에서 "F"가 선택 키를 지정 하려면 사용자는 표시 된 메뉴 항목에 대 한 캡션을 지정 "& 파일"입니다. 메뉴에 대 한 키보드 탐색을 위해이 기능을 사용할 수 있습니다. 이 생성자를 사용 하면 키보드 탐색을 제공 하는 액세스 키 외에도 바로 가기 키를 지정할 수 있습니다. 바로 가기 키를 사용 하면 메뉴 항목을 활성화 하는 키의 조합을 지정할 수 있습니다.

설정 합니다 text 매개 변수를 "-" 메뉴 항목 (가로 선) 구분 기호 대신 표준 메뉴 항목을 표시 하면 됩니다.

처리 하는 대리자를 지정 하려면이 생성자를 사용할 수는 또한는 Click 만들어지는 메뉴 항목에 대 한 이벤트입니다. 합니다 EventHandler 이 생성자에 전달 하는 처리할 수 있는 이벤트 처리기를 호출 하도록 구성 되어야 합니다는 Click 이벤트입니다. 이벤트를 처리 하는 방법은 참조 하세요 이벤트 처리 및 발생합니다.

적용 대상

MenuItem(MenuMerge, Int32, Shortcut, String, EventHandler, EventHandler, EventHandler, MenuItem[])

메뉴 항목의 지정된 캡션, MenuItem, ClickSelect 이벤트에 대해 지정된 이벤트 처리기, 바로 가기 키, 병합 유형 및 지정된 순서를 사용하여 Popup 클래스의 새 인스턴스를 초기화합니다.

public:
 MenuItem(System::Windows::Forms::MenuMerge mergeType, int mergeOrder, System::Windows::Forms::Shortcut shortcut, System::String ^ text, EventHandler ^ onClick, EventHandler ^ onPopup, EventHandler ^ onSelect, cli::array <System::Windows::Forms::MenuItem ^> ^ items);
public MenuItem (System.Windows.Forms.MenuMerge mergeType, int mergeOrder, System.Windows.Forms.Shortcut shortcut, string text, EventHandler onClick, EventHandler onPopup, EventHandler onSelect, System.Windows.Forms.MenuItem[] items);
new System.Windows.Forms.MenuItem : System.Windows.Forms.MenuMerge * int * System.Windows.Forms.Shortcut * string * EventHandler * EventHandler * EventHandler * System.Windows.Forms.MenuItem[] -> System.Windows.Forms.MenuItem
Public Sub New (mergeType As MenuMerge, mergeOrder As Integer, shortcut As Shortcut, text As String, onClick As EventHandler, onPopup As EventHandler, onSelect As EventHandler, items As MenuItem())

매개 변수

mergeType
MenuMerge

MenuMerge 값 중 하나입니다.

mergeOrder
Int32

병합된 메뉴에서 이 메뉴 항목이 놓여질 상대적 위치입니다.

shortcut
Shortcut

Shortcut 값 중 하나입니다.

text
String

메뉴 항목의 캡션입니다.

onClick
EventHandler

이 메뉴 항목의 EventHandler 이벤트를 처리하는 Click입니다.

onPopup
EventHandler

이 메뉴 항목의 EventHandler 이벤트를 처리하는 Popup입니다.

onSelect
EventHandler

이 메뉴 항목의 EventHandler 이벤트를 처리하는 Select입니다.

items
MenuItem[]

이 메뉴 항목의 하위 메뉴 항목이 들어 있는 MenuItem 개체의 배열입니다.

예제

다음 코드 예제에는 캡션 및 바로 가기 키가 있는 메뉴 항목을 만듭니다. 메뉴 항목에는 또한 이벤트 처리기에 대 한 정의는 Popup, Click, 및 Select 이벤트입니다. 이 메뉴 항목으로 병합 하는 경우 0의 병합 순서를 사용 하 여 메뉴에 메뉴 항목이 추가 됩니다.

public:
   void CreateMyMenuItem()
   {
      // Submenu item array.
      array<MenuItem^>^ subMenus = gcnew array<MenuItem^>(3);
      // Create three menu items to add to the submenu item array.
      MenuItem^ subMenuItem1 = gcnew MenuItem( "Red" );
      MenuItem^ subMenuItem2 = gcnew MenuItem( "Blue" );
      MenuItem^ subMenuItem3 = gcnew MenuItem( "Green" );
      
      // Add the submenu items to the array.
      subMenus[ 0 ] = subMenuItem1;
      subMenus[ 1 ] = subMenuItem2;
      subMenus[ 2 ] = subMenuItem3;
      /* Create a MenuItem with caption, shortcut key, 
         a Click, Popup, and Select event handler, merge type and order, and an 
         array of submenu items specified.
      */
      MenuItem^ menuItem1 = gcnew MenuItem( MenuMerge::Add, 0,
         Shortcut::CtrlShiftC, "&Colors",
         gcnew EventHandler( this, &Form1::MenuItem1_Click ),
         gcnew EventHandler( this, &Form1::MenuItem1_Popup ),
         gcnew EventHandler( this, &Form1::MenuItem1_Select ), subMenus );
   }

private:
   // The following method is an event handler for menuItem1 to use when connecting the Click event.
   void MenuItem1_Click( Object^ sender, EventArgs^ e )
   {
      // Code goes here that handles the Click event.
   }

   // The following method is an event handler for menuItem1 to use  when connecting the Popup event.
   void MenuItem1_Popup( Object^ sender, EventArgs^ e )
   {
      // Code goes here that handles the Click event.
   }

   // The following method is an event handler for menuItem1 to use  when connecting the Select event
   void MenuItem1_Select( Object^ sender, EventArgs^ e )
   {
      // Code goes here that handles the Click event.
   }
public void CreateMyMenuItem()
{
   // Submenu item array.
   MenuItem[] subMenus = new MenuItem[3];
   // Create three menu items to add to the submenu item array.
   MenuItem subMenuItem1 = new MenuItem("Red");
   MenuItem subMenuItem2 = new MenuItem("Blue");
   MenuItem subMenuItem3 = new MenuItem("Green");

   // Add the submenu items to the array.
   subMenus[0] = subMenuItem1;
   subMenus[1] = subMenuItem2;
   subMenus[2] = subMenuItem3;
   /* Create a MenuItem with caption, shortcut key, 
      a Click, Popup, and Select event handler, merge type and order, and an 
      array of submenu items specified.
   */
   MenuItem menuItem1 = new MenuItem(MenuMerge.Add, 0,
      Shortcut.CtrlShiftC, "&Colors", 
      new EventHandler(this.MenuItem1_Click),
      new EventHandler(this.MenuItem1_Popup),
      new EventHandler(this.MenuItem1_Select), subMenus);
}

// The following method is an event handler for menuItem1 to use when connecting the Click event.
private void MenuItem1_Click(Object sender, EventArgs e)
{
   // Code goes here that handles the Click event.
}

// The following method is an event handler for menuItem1 to use  when connecting the Popup event.
private void MenuItem1_Popup(Object sender, EventArgs e)
{
   // Code goes here that handles the Click event.
}

// The following method is an event handler for menuItem1 to use  when connecting the Select event
private void MenuItem1_Select(Object sender, EventArgs e)
{
   // Code goes here that handles the Click event.
}
Public Sub CreateMyMenuItem()
   ' Submenu item array.
   Dim SubMenus(3) as MenuItem
   ' Create three menu items to add to the submenu item array.
   Dim SubMenuItem1, SubMenuItem2, SubMenuItem3 as MenuItem
   SubMenuItem1 = New MenuItem ("Red")
   SubMenuItem2 = New MenuItem ("Blue")
   SubMenuItem3 = New MenuItem ("Green")
   ' Add the submenu items to the array.
   SubMenus(0) = SubMenuItem1
   SubMenus(1) = SubMenuItem2
   SubMenus(2) = SubMenuItem3
   ' Create a MenuItem with caption, shortcut key, 
   ' a Click, Popup, and Select event handler, menu merge type and order, and an 
   ' array of submenu items specified.
   Dim MenuItem1 As MenuItem
   MenuItem1 = New MenuItem(MenuMerge.Add, 0, Shortcut.CtrlShiftC, "&Colors", _
      AddressOf Me.MenuItem1_Click, _
      AddressOf Me.MenuItem1_Popup, _
      AddressOf Me.MenuItem1_Select, SubMenus)
End Sub

' The following method is an event handler for MenuItem1 to use  when connecting the Click event.
Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal  e as System.EventArgs)
   ' Code goes here that handles the Click event.
End Sub

' The following method is an event handler for MenuItem1 to use  when connecting the Popup event.
Private Sub MenuItem1_Popup(ByVal sender As System.Object, ByVal  e as System.EventArgs)
   ' Code goes here that handles the Click event.
End Sub

' The following method is an event handler for MenuItem1 to use  when connecting the Select event
Private Sub MenuItem1_Select(ByVal sender As System.Object, ByVal  e as System.EventArgs)
   ' Code goes here that handles the Click event.
End Sub

설명

메뉴 항목에 대 한 캡션을 지정 하는 경우는 text 매개 변수를 지정할 수도 있습니다 선택키가 앞에 '&' 선택 키로 사용할 문자를 배치 하 여 합니다. 예를 들어 "파일"에서 "F"가 선택 키를 지정 하려면 사용자는 표시 된 메뉴 항목에 대 한 캡션을 지정 "& 파일"입니다. 메뉴에 대 한 키보드 탐색을 위해이 기능을 사용할 수 있습니다.

설정 합니다 text 매개 변수를 "-" 메뉴 항목 (가로 선) 구분 기호 대신 표준 메뉴 항목을 표시 하면 됩니다.

items 매개 변수를 사용 하면이 메뉴 항목의 하위 메뉴를 정의할 메뉴 항목의 배열을 할당 합니다. 배열의 각 항목에 할당 된 메뉴 항목의 배열을 가질 수도 있습니다. 이 옵션을 사용 하면 전체 메뉴 구조를 만들고 메뉴 항목에 대 한 생성자에 할당할 수 있습니다.

합니다 mergeTypemergeOrder 매개 변수를 사용 하면 다른 메뉴와 메뉴 항목 병합 될 때이 메뉴 항목에서 동작 하는 방법을 확인 하려면. 에 대해 지정 하는 값에 따라는 mergeType 매개 변수를 추가, 제거, 바꾸기, 하거나 메뉴 항목 및 해당 하위 메뉴 항목으로 병합 되는 메뉴와 병합 합니다. mergeOrder 매개 변수 메뉴 병합 될 때 만들어지는 메뉴 항목 배치 될 위치를 결정 합니다.

만들려면이 생성자를 사용할 수 있습니다는 또한는 MenuItem 메뉴 항목 클릭을 처리 하는 코드에서 이벤트 처리기에 연결 되어 있습니다. 합니다 EventHandler 이 생성자에 전달 하는 처리할 수 있는 이벤트 처리기를 호출 하도록 구성 해야 합니다 Click 이벤트입니다. 이 생성자 버전을 사용 하 여 연결할 수도 있습니다는 PopupSelect 이 메뉴 항목을 선택 하는 경우를 결정 하는 이벤트입니다. 하위 메뉴 항목 옆에 있는 확인 표시 또는을 애플리케이션의 상태를 기반으로 하는 메뉴 항목을 사용할지 여부를 확인 하는 등의 작업에 대 한 이러한 이벤트를 사용할 수 있습니다. Select 하 고 Click 이벤트에 대해서만 발생 MenuItem 부모 메뉴 항목이 아닌 개체입니다. 이벤트를 처리 하는 방법은 참조 하세요 이벤트 처리 및 발생합니다.

추가 정보

적용 대상