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、このプロパティを使用すると、特定の時点でチェックされるコントロールは 1 つだけになります。
プロパティが AutoCheck に false
設定されている場合、コントロールの RadioButton グループは相互に排他的なグループとして機能せず、コードで プロパティを Checked 更新する必要があります。
製品 | バージョン |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
.NET に関するフィードバック
.NET はオープンソース プロジェクトです。 フィードバックを提供するにはリンクを選択します。