ItemCheckEventArgs.NewValue 속성

정의

항목 확인란을 선택된 상태, 선택되지 않은 상태 또는 결정되지 않은 상태 중 어떤 상태로 설정할지를 나타내는 값을 가져오거나 설정합니다.

public:
 property System::Windows::Forms::CheckState NewValue { System::Windows::Forms::CheckState get(); void set(System::Windows::Forms::CheckState value); };
public System.Windows.Forms.CheckState NewValue { get; set; }
member this.NewValue : System.Windows.Forms.CheckState with get, set
Public Property NewValue As CheckState

속성 값

CheckState 값 중 하나입니다.

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다. 예제에서는 이벤트 처리기에서 보고서를 CheckedListBox.ItemCheck 이벤트입니다. 이 보고서를 통해 이벤트 발생 하 고 도움이 될 수 있습니다 디버깅 하는 경우를 학습할 수 있습니다. 자주 발생 하는 이벤트 또는 여러 이벤트를 보고 하려면 바꾸는 것이 좋습니다 MessageBox.Show 사용 하 여 Console.WriteLine 줄에 메시지를 추가 또는 TextBox합니다.

예제 코드를 실행 하려면 형식의 인스턴스를 포함 하는 프로젝트에 붙여넣습니다 CheckedListBox 라는 CheckedListBox1합니다. 연결 된 이벤트 처리기는 확인 된 CheckedListBox.ItemCheck 이벤트입니다.

private void CheckedListBox1_ItemCheck(Object sender, ItemCheckEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Index", e.Index );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "NewValue", e.NewValue );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CurrentValue", e.CurrentValue );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "ItemCheck Event" );
}
Private Sub CheckedListBox1_ItemCheck(sender as Object, e as ItemCheckEventArgs) _ 
     Handles CheckedListBox1.ItemCheck

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "Index", e.Index)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "NewValue", e.NewValue)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "CurrentValue", e.CurrentValue)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"ItemCheck Event")

End Sub

설명

이 속성을 사용하면 컨트롤에 의해 CheckedListBox 검사 상태가 변경되기 전에 지정된 항목에 대한 새 검사 상태를 확인할 수 있습니다. 새 검사 상태를 결정하는 것 외에도 이벤트에 대한 ItemCheck 이벤트 처리기에서 이 속성을 사용하여 상태를 지정된 상태와 다른 검사 상태로 변경할 수 있습니다. 예를 들어, 사용자에서 항목 옆에 있는 확인 표시를 배치 하는 경우는 CheckedListBox 결정 한 경우 검사 하지 않도록 애플리케이션의 상태에 따라 재정의할 수 있습니다 확인란 상태가 변경 된 이전 설정 또는 t이이 속성을 설정 하 여 o 다른 검사 상태입니다.

적용 대상

추가 정보