次の方法で共有


RadioButton.CheckAlign プロパティ

オプション ボタン コントロールのチェック ボックス部分の位置を取得または設定します。

Public Property CheckAlign As ContentAlignment
[C#]
public ContentAlignment CheckAlign {get; set;}
[C++]
public: __property ContentAlignment get_CheckAlign();public: __property void set_CheckAlign(ContentAlignment);
[JScript]
public function get CheckAlign() : ContentAlignment;public function set CheckAlign(ContentAlignment);

プロパティ値

有効な ContentAlignment 値の 1 つ。既定値は MiddleLeft です。

例外

例外の種類 条件
InvalidEnumArgumentException 代入された値が、 ContentAlignment 値ではありません。

使用例

[Visual Basic, C#, C++] CheckAlign プロパティを実行時に変更する方法を次の例に示します。 Checked 値が変更されると、オプション ボタン コントロールのチェック ボックス部分がテキストの左右に移動します。このコードは、 RadioButton コントロールがフォーム上でインスタンス化されていること、および System.Drawing 名前空間への参照が含まれていることを前提にしています。

 
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


[C#] 
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;
   }
}


[C++] 

private: System::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;
    }
 }
 
};

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

RadioButton クラス | RadioButton メンバ | System.Windows.Forms 名前空間