100 Part I Getting Started with Microsoft Visual Basic 2010
press to execute a command in an open menu are called access keys. You can identify
the access key of a menu item because it’s either underlined, or, in some Windows 7
applications, it appears in a small, handy box on the menu.
Visual Studio makes it easy to provide access key support. To add an access key to a menu
item, activate the Menu Designer, and then type an ampersand (&) before the appropriate
letter in the menu name. When you open the menu at run time (when the program is
running), your program automatically supports the access key.
Menu Conventions
By convention, each menu title and menu command in a Windows application has
an initial capital letter. File and Edit are often the first two menu names on the menu bar,
and Help is usually the last. Other common menu names are View, Format, and Window.
No matter what menus and commands you use in your applications, take care to be
clear and consistent with them. Menus and commands should be easy to use and should
have as much in common as possible with those in other Windows-based applications.
As you create menu items, use the following guidelines:
n Use short, specific captions consisting of one or two words at most.
n Assign each menu item an access key. Use the first letter of the item if
possible, or the access key that is commonly assigned (such as x for Exit).
n Menu items at the same level must have a unique access key.
n If a command is used as an on/off toggle, place a check mark to the left of
the item when it’s active. You can add a check mark by setting the Checked
property of the menu command to True in the Properties window.
n Place an ellipsis (... ) after a menu command that requires the user to enter
more information before the command can be executed. The ellipsis indicates
that you’ll open a dialog box if the user selects this item.
Note By default, most versions of Windows don’t display the underline or small box for access
keys in a program until you press the ALT key for the first time. In Windows XP, you can turn off
this option by using the Effects button on the Appearance tab of the Display Properties control
panel. In Windows Vista and Windows 7, you can turn off this option by clicking the Appearance
And Personalization option in Control Panel, clicking Ease Of Access Center, clicking Make The
Keyboard Easier To Use, and then selecting Underline Keyboard Shortcuts And Access Keys.
Note, however, that in some applications running under Windows 7 (such as Visual Studio 2010
and Microsoft Office Word 2007), the access keys will not appear until you press the ALT key to
activate them.