RadioButton.CheckAlign 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定 中勾選框部分 RadioButton的位置。
public:
property System::Drawing::ContentAlignment CheckAlign { System::Drawing::ContentAlignment get(); void set(System::Drawing::ContentAlignment value); };
[System.ComponentModel.Bindable(true)]
public System.Drawing.ContentAlignment CheckAlign { get; set; }
public System.Drawing.ContentAlignment CheckAlign { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.CheckAlign : System.Drawing.ContentAlignment with get, set
member this.CheckAlign : System.Drawing.ContentAlignment with get, set
Public Property CheckAlign As ContentAlignment
屬性值
這是其中一個合理的 ContentAlignment 價值觀。 預設值為 MiddleLeft。
- 屬性
例外狀況
分配的數值並非其中之一。ContentAlignment
範例
以下程式碼範例展示了如何在執行時更改該 CheckAlign 屬性。 當值改變Checked時,a RadioButton 的勾選框部分會移至文字的右側或左側。 此範例要求在表單上實例化控制 RadioButton 項,且包含對命名 System.Drawing 空間的參考。
private:
Void radioButton1_CheckedChanged( System::Object^ sender,
System::EventArgs^ e )
{
// Change the check box position to be opposite its current position.
if ( radioButton1->CheckAlign == ContentAlignment::MiddleLeft )
{
radioButton1->CheckAlign = ContentAlignment::MiddleRight;
}
else
{
radioButton1->CheckAlign = ContentAlignment::MiddleLeft;
}
}
private void radioButton1_CheckedChanged(Object sender,
EventArgs e)
{
// Change the check box position to be opposite its current position.
if (radioButton1.CheckAlign == ContentAlignment.MiddleLeft)
{
radioButton1.CheckAlign = ContentAlignment.MiddleRight;
}
else
{
radioButton1.CheckAlign = ContentAlignment.MiddleLeft;
}
}
Private Sub radioButton1_CheckedChanged(sender As Object, e As EventArgs)
' Change the check box position to be opposite its current position.
If radioButton1.CheckAlign = ContentAlignment.MiddleLeft Then
radioButton1.CheckAlign = ContentAlignment.MiddleRight
Else
radioButton1.CheckAlign = ContentAlignment.MiddleLeft
End If
End Sub