MenuCommand.Visible Property

 

Gets or sets a value indicating whether this menu item is visible.

Namespace:   System.ComponentModel.Design
Assembly:  System (in System.dll)

Public Overridable Property Visible As Boolean

Property Value

Type: System.Boolean

true if the item is visible; otherwise, false.

The following code example creates a MenuCommand object, configures its properties, and adds it to the IMenuCommandService.

<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Public Class CDesigner
    Inherits System.ComponentModel.Design.ComponentDesigner

    Public Overrides Sub Initialize(ByVal comp As IComponent)
        MyBase.Initialize(comp)

        Dim mcs As IMenuCommandService = CType(comp.Site.GetService(GetType(IMenuCommandService)), IMenuCommandService)
        Dim mc As New MenuCommand(New EventHandler(AddressOf OnF1Help), StandardCommands.F1Help)
        mc.Enabled = True
        mc.Visible = True
        mc.Supported = True
        mcs.AddCommand(mc)
        System.Windows.Forms.MessageBox.Show("Initialize() has been invoked.")
    End Sub

    Private Sub OnF1Help(ByVal sender As Object, ByVal e As EventArgs)
        System.Windows.Forms.MessageBox.Show("F1Help has been invoked.")
    End Sub
End Class

.NET Framework
Available since 1.1
Return to top
Show: