本文整理匯總了VB.NET中System.ComponentModel.Design.MenuCommand類的典型用法代碼示例。如果您正苦於以下問題:VB.NET MenuCommand類的具體用法?VB.NET MenuCommand怎麽用?VB.NET MenuCommand使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了MenuCommand類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: New
' 導入命名空間
Imports System.ComponentModel
Imports System.ComponentModel.Design
Namespace VbMenuCommand
<Designer(GetType(CDesigner))> _
Public Class Component1
Inherits System.ComponentModel.Component
Private components As System.ComponentModel.Container = Nothing
Public Sub New(ByVal container As System.ComponentModel.IContainer)
container.Add(Me)
InitializeComponent()
End Sub
Public Sub New()
InitializeComponent()
End Sub
Private Sub InitializeComponent()
End Sub
End Class
<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
End Namespace