CheckBox.CheckAlign 속성

정의

CheckBox 컨트롤에 있는 확인 표시의 가로 및 세로 맞춤을 가져오거나 설정합니다.

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; }
[<System.ComponentModel.Bindable(true)>]
member this.CheckAlign : System.Drawing.ContentAlignment with get, set
Public Property CheckAlign As ContentAlignment

속성 값

ContentAlignment 값 중 하나입니다. 기본값은 MiddleLeft입니다.

특성

예외

할당된 값이 ContentAlignment 열거형 값이 아닌 경우

예제

다음 코드 예제에서는 레이블에 세 속성의 값을 표시 합니다. ThreeState 합니다 속성 사이 true 대체 하 false 고 번갈아 클릭을 사용 하 고는 컨트롤 및 CheckAlign 의 값을 ContentAlignment대체 합니다 MiddleRightMiddleLeft. 이 예제에서는 속성이 변경되고 컨트롤이 ThreeState 확인되면 속성 값이 어떻게 변경되는지 보여 집니다. 이 예제에서는 및 LabelButtonCheckBox양식에서 모두 인스턴스화되고 레이블이 세 줄의 텍스트와 네임스페이스에 대한 참조를 표시할 수 있을 만큼 커야 합니다System.Drawing. 이 코드는 컨트롤의 Click 이벤트 처리기에서 호출되어야 합니다.

private:
   void AdjustMyCheckBoxProperties()
   {
      // Concatenate the property values together on three lines.
      label1->Text = String::Format( "ThreeState: {0}\nChecked: {1}\nCheckState: {2}",
         checkBox1->ThreeState, checkBox1->Checked, checkBox1->CheckState );
      
      // Change the ThreeState and CheckAlign properties on every other click.
      if ( !checkBox1->ThreeState )
      {
         checkBox1->ThreeState = true;
         checkBox1->CheckAlign = ContentAlignment::MiddleRight;
      }
      else
      {
         checkBox1->ThreeState = false;
         checkBox1->CheckAlign = ContentAlignment::MiddleLeft;
      }
   }
private void AdjustMyCheckBoxProperties()
 {
    // Change the ThreeState and CheckAlign properties on every other click.
    if (!checkBox1.ThreeState)
    {
       checkBox1.ThreeState = true;
       checkBox1.CheckAlign = ContentAlignment.MiddleRight;
    }
    else
    {
       checkBox1.ThreeState = false;
       checkBox1.CheckAlign = ContentAlignment.MiddleLeft;
    }

    // Concatenate the property values together on three lines.
    label1.Text = "ThreeState: " + checkBox1.ThreeState.ToString() + "\n" +
                  "Checked: " + checkBox1.Checked.ToString() + "\n" +
                  "CheckState: " + checkBox1.CheckState.ToString(); 
 }
Private Sub AdjustMyCheckBoxProperties()

    ' Change the ThreeState and CheckAlign properties on every other click.
    If Not checkBox1.ThreeState Then
        checkBox1.ThreeState = True
        checkBox1.CheckAlign = ContentAlignment.MiddleRight
    Else
        checkBox1.ThreeState = False
        checkBox1.CheckAlign = ContentAlignment.MiddleLeft
    End If

    ' Concatenate the property values together on three lines.
    label1.Text = "ThreeState: " & checkBox1.ThreeState.ToString() & ControlChars.Cr & _
        "Checked: " & checkBox1.Checked.ToString() & ControlChars.Cr & _
        "CheckState: " & checkBox1.CheckState.ToString()

End Sub

적용 대상

추가 정보