Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can enhance the usability of MenuStrip and ContextMenuStrip controls in the following ways:
Add check marks to designate whether a feature is turned on or off, such as whether a ruler is displayed along the margin of a word-processing application, or to indicate which file in a list of files is being displayed, such as on a Window menu.
Add images that visually represent menu commands.
Display shortcut keys to provide a keyboard alternative to the mouse for performing commands. For example, pressing CTRL+C performs the Copy command.
Display access keys to provide a keyboard alternative to the mouse for menu navigation. For example, pressing ALT+F chooses the File menu.
Show separator bars to group related commands and make menus more readable.
Set its Checked property to true
.
This also sets the CheckState property to true
. Use this procedure only if you want the menu command to appear as checked by default, regardless of whether it is selected.
true
.Note
The image margin can also show a check mark if you so choose. Also, you can set the Checked property of the image to true
, and the image will appear with a hatched border around it at run time.
true
.true
.When you set the Text property for the menu command, enter an ampersand (&) before the letter you want to be underlined as the access key. For example, typing &Open
as the Text property of a menu item will result in a menu command that appears as Open.
To navigate to this menu command, press ALT to give focus to the MenuStrip, and press the access key of the menu name. When the menu opens and shows items with access keys, you only need to press the access key to select the menu command.
Note
Avoid defining duplicate access keys, such as defining ALT+F twice in the same menu system. The selection order of duplicate access keys cannot be guaranteed.
After you define your MenuStrip and the items it will contain, use the AddRange or Add method to add the menu commands and ToolStripSeparator controls to the MenuStrip in the order you want.
' This code adds a top-level File menu to the MenuStrip.
Me.menuStrip1.Items.Add(New ToolStripMenuItem() _
{Me.fileToolStripMenuItem})
' This code adds the New and Open menu commands, a separator bar,
' and the Save and Exit menu commands to the top-level File menu,
' in that order.
Me.fileToolStripMenuItem.DropDownItems.AddRange(New _
ToolStripMenuItem() {Me.newToolStripMenuItem, _
Me.openToolStripMenuItem, Me.toolStripSeparator1, _
Me.saveToolStripMenuItem, Me.exitToolStripMenuItem})
// This code adds a top-level File menu to the MenuStrip.
this.menuStrip1.Items.Add(new ToolStripItem[]_
{this.fileToolStripMenuItem});
// This code adds the New and Open menu commands, a separator bar,
// and the Save and Exit menu commands to the top-level File menu,
// in that order.
this.fileToolStripMenuItem.DropDownItems.AddRange(new _
ToolStripItem[] {
this.newToolStripMenuItem,
this.openToolStripMenuItem,
this.toolStripSeparator1,
this.saveToolStripMenuItem,
this.exitToolStripMenuItem});
.NET Desktop feedback feedback
.NET Desktop feedback is an open source project. Select a link to provide feedback:
Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
Please sign in to use this experience.
Sign in