本文整理汇总了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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:7,代码来源:MenuItem
示例2: CreateMyMenus
Public Sub CreateMyMenus()
' Create an instance of a MenuItem with a specified caption.
menuItem1 = New MenuItem("&File")
End Sub
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:4,代码来源:MenuItem
示例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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:12,代码来源:MenuItem
示例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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:15,代码来源:MenuItem
示例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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:12,代码来源:MenuItem
示例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
开发者ID:VB.NET开发者,项目名称:System.Windows.Forms,代码行数:36,代码来源:MenuItem
注:本文中的System.Windows.Forms.MenuItem.MenuItem构造函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论