本文整理汇总了VB.NET中System.Windows.Forms.MenuItem.MenuItem构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET MenuItem构造函数的具体用法?VB.NET MenuItem怎么用?VB.NET MenuItem使用的例子?那么, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Windows.Forms.MenuItem
的用法示例。
在下文中一共展示了MenuItem构造函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: CreateMyMenu
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
示例2: CreateMyMenus
Public Sub CreateMyMenus()
' Create an instance of a MenuItem with a specified caption.
menuItem1 = New MenuItem("&File")
End Sub
示例3: CreateMyMenuItem
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
示例4: CreateMyMenuItem
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
示例5: CreateMyMenuItem
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
示例6: CreateMyMenuItem
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