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.Checked

Gets or sets a value indicating whether a checkmark appears beside the text of the menu item.

[Visual Basic]
Public Property Checked As Boolean
[C#]
public bool Checked {get; set;}
[C++]
public: __property bool get_Checked();
public: __property void set_Checked(bool);
[JScript]
public function get Checked() : Boolean;
public function set Checked(Boolean);

Property Value

true if the menu item is to be checked; otherwise, false. The default is false.

Remarks

You can use the TBD property in combination with other menu items in a menu to provide state for an application. For example, you could place a checkmark on a menu item in a group of items to identify the size of the font to be displayed for the text in an application.

Example [Visual Basic]

The following example uses the TBD property to provide the state in an application. In this example, a group of menu items are used to specify the color for the text in an TBD control. The event handler provided is used by the TBD event of three menu items. Each menu item specifies a text color, menuRed (Red), menuGreen (Green), or menuBlue (Blue). The event handler determines which menu item was clicked, places a checkmark to the selected menu item, and changes the text color of the form's TBD control.

[Visual Basic]

' The following event handler would be connected to three menu 
items.
Public Sub MyMenuClick(ByVal sender as System.Object, ByVal e as 
System.EventArgs)
   'Determine if clicked menu item is the Blue menu item.
   If sender Is menuBlue Then
      ' Set the checkmark for the menuBlue menu item.
      menuBlue.Checked = True
      ' Uncheck the menuRed and menuGreen menu items.
      menuRed.Checked = False
      menuGreen.Checked = False
      ' Set the color of the text in the Edit control to Blue.
      Set Edit1.ForeColor = System.Drawing.Color.Blue
   Else If sender Is menuRed Then
      ' Set the checkmark for the menuRed menu item.
     menuRed.Checked = True
      ' Uncheck the menuBlue and menuGreen menu items.
      menuBlue.Checked = False
      menuGreen.Checked = False
      ' Set the color of the text in the Edit control to menuRed.
      Set Edit1.ForeColor = System.Drawing.Color.Red
   Else
      ' Set the checkmark for the Green menu item.
      menuGreen.Checked = True
      ' Uncheck the Red and Green menu items.
      menuBlue.Checked = False
      menuRed.Checked = False
      ' Set the color of the text in the Edit control to Blue.
      Set Edit1.ForeColor = System.Drawing.Color.Green
   End If
End Sub

See Also

MenuItem Class | MenuItem Members | System.WinForms Namespace