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