Gets or sets a value indicating whether the MenuItem, if checked, displays a radio-button instead of a check mark.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The following code example uses the Checked property to change the state of an application. In the example, a group of menu items are provided that are used to specify the color for the text in an TextBox control. In the example, the event handler provided is used by the Click event of the three menu items. Each menu item specifies a color, menuItemRed, menuItemGreen, or menuItemBlue. 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 TextBox control, named textBox1. The example also uses the property to demonstrate how a radio-button check is used to show menu items that are mutually exclusive. This example requires that the System.Drawing namespace has been added to the form that contains this code.
' This method is called from the constructor of the form to set up the menu ' items. Public Sub ConfigureMyMenus() ' Set all of these menu items to Radio-Button check marks so the user ' can see that only one color can be selected at a time. menuItemRed.RadioCheck = True menuItemBlue.RadioCheck = True menuItemGreen.RadioCheck = True End Sub ' The following event handler would be connected to three menu items. Private Sub MyMenuClick(sender As Object, e As EventArgs) If sender Is menuItemBlue Then ' Set the checkmark for the menuItemBlue menu item. menuItemBlue.Checked = True ' Uncheck the menuItemRed and menuItemGreen menu items. menuItemRed.Checked = False menuItemGreen.Checked = False ' Set the color of the text in the TextBox control to Blue. textBox1.ForeColor = Color.Blue Else If sender Is menuItemRed Then ' Set the checkmark for the menuItemRed menu item. menuItemRed.Checked = True ' Uncheck the menuItemBlue and menuItemGreen menu items. menuItemBlue.Checked = False menuItemGreen.Checked = False ' Set the color of the text in the TextBox control to Red. textBox1.ForeColor = Color.Red Else ' Set the checkmark for the menuItemGreen menu item. menuItemGreen.Checked = True ' Uncheck the menuItemRed and menuItemGreen menu items. menuItemBlue.Checked = False menuItemRed.Checked = False ' Set the color of the text in the TextBox control to Blue. textBox1.ForeColor = Color.Green End If End If End Sub
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.