MenuItem 생성자

정의

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

오버로드

Name Description
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()

Source:
MenuItem.cs
Source:
MenuItem.cs

빈 캡션을 사용하여 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)

Source:
MenuItem.cs
Source:
MenuItem.cs

메뉴 항목에 대해 지정된 캡션을 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"를 액세스 키로 지정하려면 메뉴 항목의 캡션을 "&File"로 지정합니다. 이 기능을 사용하여 메뉴에 대한 키보드 탐색을 제공할 수 있습니다.

매개 변수를 text "-"로 설정하면 메뉴 항목이 표준 메뉴 항목이 아닌 구분 기호(가로줄)로 표시됩니다.

적용 대상

MenuItem(String, EventHandler)

Source:
MenuItem.cs
Source:
MenuItem.cs

메뉴 항목의 이벤트에 대해 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"를 액세스 키로 지정하려면 메뉴 항목의 캡션을 "&File"로 지정합니다. 이 기능을 사용하여 메뉴에 대한 키보드 탐색을 제공할 수 있습니다.

매개 변수를 text "-"로 설정하면 메뉴 항목이 표준 메뉴 항목이 아닌 구분 기호(가로줄)로 표시됩니다.

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

적용 대상

MenuItem(String, MenuItem[])

Source:
MenuItem.cs
Source:
MenuItem.cs

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

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"를 액세스 키로 지정하려면 메뉴 항목의 캡션을 "&File"로 지정합니다. 이 기능을 사용하여 메뉴에 대한 키보드 탐색을 제공할 수 있습니다.

매개 변수를 text "-"로 설정하면 메뉴 항목이 표준 메뉴 항목이 아닌 구분 기호(가로줄)로 표시됩니다.

매개 items 변수를 사용하면 메뉴 항목 배열을 할당하여 이 메뉴 항목의 하위 메뉴를 정의할 수 있습니다. 배열의 각 항목에는 메뉴 항목 배열이 할당되어 있을 수도 있습니다. 이렇게 하면 전체 메뉴 구조를 만들고 메뉴 항목의 생성자에 할당할 수 있습니다.

이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생을 참조하세요.

적용 대상

MenuItem(String, EventHandler, Shortcut)

Source:
MenuItem.cs
Source:
MenuItem.cs

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

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"를 액세스 키로 지정하려면 메뉴 항목의 캡션을 "&File"로 지정합니다. 이 기능을 사용하여 메뉴에 대한 키보드 탐색을 제공할 수 있습니다. 또한 이 생성자를 사용하면 액세스 키 외에도 바로 가기 키를 지정하여 키보드 탐색을 제공할 수 있습니다. 바로 가기 키를 사용하면 메뉴 항목을 활성화하는 데 사용할 수 있는 키 조합을 지정할 수 있습니다.

매개 변수를 text "-"로 설정하면 메뉴 항목이 표준 메뉴 항목이 아닌 구분 기호(가로줄)로 표시됩니다.

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

적용 대상

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

Source:
MenuItem.cs
Source:
MenuItem.cs

지정된 캡션, 정의된 이벤트 처리기, 바로 가기 키, 병합 형식 및 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 대한 하위 메뉴 항목을 포함하는 개체의 배열입니다.

예제

다음 코드 예제에서는 캡션 및 바로 가기 키가 있는 메뉴 항목을 만듭니다. 메뉴 항목에는 , PopupClick 이벤트에 대해 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"를 액세스 키로 지정하려면 메뉴 항목의 캡션을 "&File"로 지정합니다. 이 기능을 사용하여 메뉴에 대한 키보드 탐색을 제공할 수 있습니다.

매개 변수를 text "-"로 설정하면 메뉴 항목이 표준 메뉴 항목이 아닌 구분 기호(가로줄)로 표시됩니다.

매개 items 변수를 사용하면 메뉴 항목 배열을 할당하여 이 메뉴 항목의 하위 메뉴를 정의할 수 있습니다. 배열의 각 항목에는 메뉴 항목 배열이 할당되어 있을 수도 있습니다. 이렇게 하면 전체 메뉴 구조를 만들고 메뉴 항목의 생성자에 할당할 수 있습니다.

mergeTypemergeOrder 매개 변수를 사용하면 메뉴 항목이 다른 메뉴와 병합될 때 이 메뉴 항목의 동작 방식을 결정할 수 있습니다. 매개 변수에 지정 mergeType 한 값에 따라 메뉴 항목과 해당 하위 메뉴 항목을 병합하는 메뉴와 추가, 제거, 바꾸기 또는 병합할 수 있습니다. 매개 변수는 mergeOrder 메뉴가 병합될 때 생성되는 메뉴 항목의 위치를 결정합니다.

또한 이 생성자를 MenuItem 사용하여 메뉴 항목의 클릭을 처리하는 코드의 이벤트 처리기에 연결하도록 할 수 있습니다. 이 생성자에 전달하는 것은 EventHandler 이벤트를 처리 Click 할 수 있는 이벤트 처리기를 호출하도록 구성되어야 합니다. 이 생성자 버전을 사용하여 이벤트와 Popup 연결 Select 하여 이 메뉴 항목이 선택된 시기를 확인할 수도 있습니다. 하위 메뉴 항목 옆에 확인 표시를 표시할지 또는 애플리케이션의 상태에 따라 메뉴 항목을 사용하거나 사용하지 않도록 설정할지 여부를 결정하는 등의 작업에 이러한 이벤트를 사용할 수 있습니다. SelectClick 이벤트는 부모 메뉴 항목이 아닌 개체에 MenuItem 대해서만 발생합니다. 이벤트 처리에 대한 자세한 내용은 이벤트 처리 및 발생을 참조하세요.

추가 정보

적용 대상