RadioButton.AutoCheck 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,它指示:在单击控件时,Checked 值和控件的外观是否自动更改。
public:
property bool AutoCheck { bool get(); void set(bool value); };
public bool AutoCheck { get; set; }
member this.AutoCheck : bool with get, set
Public Property AutoCheck As Boolean
属性值
如果在发生 Checked 事件时自动更改 Click 值和控件的外观,则为 true;否则为 false。 默认值是 true。
示例
下面的代码示例创建并初始化 , RadioButton为它提供切换控件的外观,将其 AutoCheck 属性设置为 false,并将其添加到 Form。
private void InitializeMyRadioButton()
{
// Create and initialize a new RadioButton.
RadioButton radioButton1 = new RadioButton();
// Make the radio button control appear as a toggle button.
radioButton1.Appearance = Appearance.Button;
// Turn off the update of the display on the click of the control.
radioButton1.AutoCheck = false;
// Add the radio button to the form.
Controls.Add(radioButton1);
}
Private Sub InitializeMyRadioButton()
' Create and initialize a new RadioButton.
Dim radioButton1 As New RadioButton()
' Make the radio button control appear as a toggle button.
radioButton1.Appearance = Appearance.Button
' Turn off the update of the display on the click of the control.
radioButton1.AutoCheck = False
' Add the radio button to the form.
Controls.Add(radioButton1)
End Sub
注解
如果值 Checked 设置为 false, RadioButton 则必须在事件处理程序中的代码中 Click 签入控件部分。 此外,如果 RadioButton 是控件组的一 RadioButton 部分,则此属性可确保在给定时间仅检查其中一个控件。
如果 属性 AutoCheck 设置为 false,则控件组 RadioButton 不会充当互斥组, Checked 并且必须在代码中更新该属性。