MenuItem.Visible 속성

정의

메뉴 항목이 표시되는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool Visible { bool get(); void set(bool value); };
public bool Visible { get; set; }
member this.Visible : bool with get, set
Public Property Visible As Boolean

속성 값

메뉴 항목이 메뉴에 표시되면 기본값은 true입니다.

예제

다음 코드 예제에서는 메뉴 항목을 만들고, 캡션을 설정하고, 바로 가기 키를 할당하고, 메뉴 항목을 표시하고, 메뉴 항목에 대한 바로 가기 키 표시를 보여 줍니다. 이 예제에서는 이름이 MenuItem지정된 a menuItem1 를 만들어야 합니다.

public:
   void SetupMyMenuItem()
   {
      // Set the caption for the menu item.
      menuItem1->Text = "&New";
      // Assign a shortcut key.
      menuItem1->Shortcut = Shortcut::CtrlN;
      // Make the menu item visible.
      menuItem1->Visible = true;
      // Display the shortcut key combination.
      menuItem1->ShowShortcut = true;
   }
public void SetupMyMenuItem()
{
   // Set the caption for the menu item.
   menuItem1.Text = "&New";
   // Assign a shortcut key.
   menuItem1.Shortcut = Shortcut.CtrlN;
   // Make the menu item visible.
   menuItem1.Visible = true;
   // Display the shortcut key combination.
   menuItem1.ShowShortcut = true;
}
Public Sub SetupMyMenuItem()
    ' Set the caption for the menu item.
    menuItem1.Text = "&New"
    ' Assign a shortcut key.
    menuItem1.Shortcut = Shortcut.CtrlN
    ' Make the menu item visible.
    menuItem1.Visible = True
    ' Display the shortcut key combination.
    menuItem1.ShowShortcut = True
End Sub

설명

메뉴를 병합하거나 메뉴를 사용하지 않도록 설정하지 않고도 이 속성을 사용하여 메뉴 구조를 수정할 수 있습니다. 예를 들어 애플리케이션의 메뉴에서 기능의 전체 섹션을 숨기려면이 속성을 false설정하여 사용자로부터 숨길 수 있습니다.

적용 대상