- 1、本文档共9页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
VB.NET-ADVANCEDFORM.PDF
VB.N T - ADVANC D FORM
VB.N T - ADVANC D FORM
http://www.tutorialspoint .com//_advanced_forms.htm Copy right ©
In this chapter, let us study the following concepts:
Adding menus and sub menus in an application
Adding the cut, copy and paste functionalities in a form
A nchoring and docking controls in a form
Modal forms
Adding Menus and Sub Menus in an Application
T raditionally, the Menu, MainMenu, ContextMenu, and MenuItem classes were used for adding
menus, sub-menus and context menus in a Windows application.
Now, the MenuStrip, the ToolStripMenuItem, ToolStripDropDown and
ToolStripDropDownMenu controls replace and add functionality to the Menu-related controls of
previous versions. However, the old control classes are retained for both backward compatibility
and future use.
Let us create a typical windows main menu bar and sub menus using the old version controls first
since these controls are still much used in old applications.
Following is an example, which shows how we create a menu bar with menu items: File, dit, V iew
and Project. T he File menu has the sub menus New, Open and Save.
Lets double click on the Form and put the following code in the opened window.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) andles MyBase.Load
defining the main menu bar
Dim mnuBar As New MainMenu()
defining the menu items for the main menu bar
Dim myMenuItemFile As New MenuItem (File)
Dim myMenuItemEdit As New MenuItem (Edit)
Dim myMenuItemView As New MenuItem (View)
Dim myMenuItemProject As New MenuItem (Project)
adding the menu items to the main menu bar
mnuBar.MenuItems.Add(myMenuItemFile)
mnuBar.MenuItems.Add(myMenuItemEdit)
mnuBar.MenuItems.Add(myMenuItemView)
mnuBar.MenuItems.Add(myMenuItemProject
文档评论(0)