Bagikan melalui


RadioButton.CheckAlign Properti

Definisi

Mendapatkan atau mengatur lokasi bagian kotak centang dari RadioButtonbagian .

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

Nilai Properti

Salah satu nilai yang valid ContentAlignment . Nilai defaultnya adalah MiddleLeft.

Atribut

Pengecualian

Nilai yang ditetapkan bukan salah ContentAlignment satu nilai.

Contoh

Contoh kode berikut menunjukkan bagaimana CheckAlign properti dapat diubah pada waktu proses. Bagian kotak centang dari dipindahkan RadioButton ke kanan atau kiri teks saat Checked nilai berubah. Contoh ini mengharuskan RadioButton kontrol telah dibuat pada formulir dan bahwa referensi ke System.Drawing namespace telah disertakan.

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

Berlaku untuk