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 ,的核取方塊部分 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