NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MenuItem.Shortcut

Gets or sets the shortcut key associated with the menu item.

[Visual Basic]
Public Property Shortcut As Shortcut
[C#]
public Shortcut Shortcut {get; set;}
[C++]
public: __property Shortcut get_Shortcut();
public: __property void set_Shortcut(Shortcut);
[JScript]
public function get Shortcut() : Shortcut;
public function set Shortcut(Shortcut);

Property Value

A Shortcut value that represents the shortcut key for this menu item.

Remarks

Shorcut keys provide a method for users to activate frequently used menu items in your menu system and to provide keyboard access to your application for those users who do not have access to a mouse or other pointer device.

Example [Visual Basic]

The following example creates a menu item, sets the caption, assigns a shortcut key, makes the menu item visible, and shows the shortcut key display for the menu item. The example assumes a MenuItem object has been created that is named MenuItem1.

[Visual Basic]

Public Sub SetupMyMenuItem()
   ' Set the caption for the menu item.
   MenuItem1.Text = "&NePublic Sub SetupMyMenuItem()
   ' Set the caption for the menu item.
   MenuItem1.Text = "&New"
   ' Assign a shortcut key.
   MenuItem1.Shortcut = Shortcut.CtrlN
   ' Make the menu item visible.
   MenuItem1.Visible = True
   ' Display the shortcutkey combination.
   MenuItem1.ShowShortcut = True
End Subw"
   ' Assign a shortcut key.
   MenuItem1.Shortcut = Shortcut.CtrlN
   ' Make the menu item visible.
   MenuItem1.Visible = False
   ' Display the shortcutkey combination.
   MenuItem1.ShowShortcut = False
End Sub

See Also

MenuItem Class | MenuItem Members | System.WinForms Namespace | Shortcut