本文整理匯總了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