MenuItem.Index 속성

정의

부모 메뉴에서 메뉴 항목의 위치를 나타내는 값을 가져오거나 설정합니다.

public:
 property int Index { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int Index { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Index : int with get, set
Public Property Index As Integer

속성 값

부모 메뉴에서 메뉴 항목의 위치를 나타내는 인덱스(0부터 시작)입니다.

특성

예외

할당된 값이 0보다 작거나 항목 수보다 큽니다.

예제

다음 코드 예제에서는 메뉴에서 두 메뉴 항목의 위치를 전환 합니다. 다음 코드 예제에서는 두 MenuItem 개의 개체를 만들고 이름을 지정 menuItem1 해야 menuItem2합니다. 메뉴 항목은 menuItem1 메뉴에서 menuItem2 한 위치 아래로 이동하고 한 위치 위로 이동합니다.

public:
   void SwitchMyMenuItems()
   {
      // Move menuItem1 down one position in the menu order.
      menuItem1->Index = menuItem1->Index + 1;
      // Move menuItem2 up one position in the menu order.
      menuItem2->Index = menuItem2->Index - 1;
   }
public void SwitchMyMenuItems()
{
   // Move menuItem1 down one position in the menu order.
   menuItem1.Index = menuItem1.Index + 1;
   // Move menuItem2 up one position in the menu order.
   menuItem2.Index = menuItem2.Index - 1;
}
Public Sub SwitchMyMenuItems()
    ' Move menuItem1 down one position in the menu order.
    menuItem1.Index = menuItem1.Index + 1
    ' Move menuItem2 up one position in the menu order.
    menuItem2.Index = menuItem2.Index - 1
End Sub

설명

이 속성은 부모 메뉴의 메뉴 항목 컬렉션에서 메뉴 항목의 인덱싱된 위치를 제공합니다. 이 속성을 사용하여 메뉴 항목의 위치를 메뉴 내의 다른 위치로 변경할 수 있습니다. 만들 때 메뉴 구조에서 해당 위치를 지정 하는 만들 때 MenuItem 이 속성을 사용할 수도 있습니다.

적용 대상