DrawItemEventArgs.State 속성

정의

그리고 있는 항목의 상태를 가져옵니다.

public:
 property System::Windows::Forms::DrawItemState State { System::Windows::Forms::DrawItemState get(); };
public System.Windows.Forms.DrawItemState State { get; }
member this.State : System.Windows.Forms.DrawItemState
Public ReadOnly Property State As DrawItemState

속성 값

그리고 있는 항목의 상태를 나타내는 DrawItemState입니다.

예제

다음 코드 예제에서는이 멤버를 사용 하는 방법을 보여 줍니다. 예제에서는 이벤트 처리기에서 보고서를 ListBox.DrawItem 이벤트입니다. 이 보고서는 이벤트가 발생하는 시기를 학습하는 데 도움이 되며 디버깅에 도움이 될 수 있습니다.

예제 코드를 실행하려면 라는 ListBox1형식 ListBox 의 instance 포함하는 프로젝트에 붙여넣습니다. 그런 다음 이벤트 처리기가 이벤트와 연결되어 있는지 확인합니다 ListBox.DrawItem .

private void ListBox1_DrawItem(Object sender, DrawItemEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "BackColor", e.BackColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Bounds", e.Bounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Font", e.Font );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ForeColor", e.ForeColor );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Index", e.Index );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "DrawItem Event" );
}
Private Sub ListBox1_DrawItem(sender as Object, e as DrawItemEventArgs) _ 
     Handles ListBox1.DrawItem

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "BackColor", e.BackColor)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Bounds", e.Bounds)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Font", e.Font)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ForeColor", e.ForeColor)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Index", e.Index)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "State", e.State)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"DrawItem Event")

End Sub

설명

이 속성 값은 열거형 멤버의 조합일 DrawItemState 수 있습니다. 멤버는 비트 연산자를 사용하여 결합할 수 있습니다.

적용 대상

추가 정보