CheckBox.Checked 속성

정의

CheckBox가 선택되어 있는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool Checked { bool get(); void set(bool value); };
[System.ComponentModel.Bindable(true)]
public bool Checked { get; set; }
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.SettingsBindable(true)]
public bool Checked { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.Checked : bool with get, set
[<System.ComponentModel.Bindable(true)>]
[<System.ComponentModel.SettingsBindable(true)>]
member this.Checked : bool with get, set
Public Property Checked As Boolean

속성 값

CheckBox가 선택되어 있으면 true이고, 그렇지 않으면 false입니다. 기본값은 false입니다.

참고: 속성이 로 ThreeState 설정된 true경우 속성은 Checked 또는CheckStateIndeterminate 에 대해 Checked 를 반환 true 합니다.

특성

예제

다음 코드 예제에서는 레이블에 세 속성의 값을 표시 합니다. ThreeState 속성은 와 를 falsetrue 번갈아 가며 컨트롤을 번갈아 클릭하고 값과 CheckAlignMiddleLeft를 번갈아 가며 대체합니다 ContentAlignmentMiddleRight. 이 예제에서는 속성이 변경되고 컨트롤이 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

설명

값이 이 CheckBoxtrue컨트롤의 부분에 검사 표시가 표시됩니다. 경우는 Appearance 속성이 설정 Button된 , 컨트롤이 때 침몰 Checked 표시 됩니다는 때 true 표준 단추 false처럼 발생 합니다.

적용 대상

추가 정보