本文整理汇总了VB.NET中System.Windows.Forms.MenuItem.PerformSelect方法的典型用法代码示例。如果您正苦于以下问题:VB.NET MenuItem.PerformSelect方法的具体用法?VB.NET MenuItem.PerformSelect怎么用?VB.NET MenuItem.PerformSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.MenuItem
的用法示例。
在下文中一共展示了MenuItem.PerformSelect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: CreateMyMenu
Public Sub CreateMyMenu()
' Create a main menu object.
Dim mainMenu1 As New MainMenu()
' Create empty menu item objects.
Dim menuItem1 As New MenuItem()
Dim menuItem2 As New MenuItem()
' Set the caption of the menu items.
menuItem1.Text = "&File"
menuItem2.Text = "&Edit"
' Add the menu items to the main menu.
mainMenu1.MenuItems.Add(menuItem1)
mainMenu1.MenuItems.Add(menuItem2)
' Add functionality to the menu items.
AddHandler menuItem1.Select, AddressOf Me.menuItem1_Select
AddHandler menuItem2.Select, AddressOf Me.menuItem2_Select
' Assign mainMenu1 to the form.
Me.Menu = mainMenu1
' Select the File menu item.
menuItem1.PerformSelect()
End Sub
Private Sub menuItem1_Select(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show("You selected the File menu.", "The Event Information")
End Sub
Private Sub menuItem2_Select(ByVal sender As Object, ByVal e As System.EventArgs)
MessageBox.Show("You selected the Edit menu.", "The Event Information")
End Sub