TableLayoutPanel.CellPaint Ereignis

Definition

Tritt ein, wenn die Zelle neu gezeichnet wird.

public:
 event System::Windows::Forms::TableLayoutCellPaintEventHandler ^ CellPaint;
public event System.Windows.Forms.TableLayoutCellPaintEventHandler CellPaint;
public event System.Windows.Forms.TableLayoutCellPaintEventHandler? CellPaint;
member this.CellPaint : System.Windows.Forms.TableLayoutCellPaintEventHandler 
Public Custom Event CellPaint As TableLayoutCellPaintEventHandler 

Ereignistyp

Beispiele

Im folgenden Codebeispiel wird die Verwendung dieses Members veranschaulicht. Im Beispiel meldet ein Ereignishandler das Auftreten des Ereignisses CellPaint . Dieser Bericht hilft Ihnen, zu erfahren, wann das Ereignis eintritt, und kann Sie beim Debuggen unterstützen.

Um den Beispielcode auszuführen, fügen Sie ihn in ein Projekt ein, das eine instance des Typs TableLayoutPanel enthältTableLayoutPanel1. Stellen Sie dann sicher, dass der Ereignishandler dem CellPaint Ereignis zugeordnet ist.

private void TableLayoutPanel1_CellPaint(Object sender, TableLayoutCellPaintEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "CellBounds", e.CellBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Row", e.Row );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Column", e.Column );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ClipRectangle", e.ClipRectangle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellPaint Event" );
}
Private Sub TableLayoutPanel1_CellPaint(sender as Object, e as TableLayoutCellPaintEventArgs) _ 
     Handles TableLayoutPanel1.CellPaint

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "CellBounds", e.CellBounds)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Row", e.Row)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Column", e.Column)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ClipRectangle", e.ClipRectangle)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"CellPaint Event")

End Sub

Hinweise

Weitere Informationen zur Behandlung von Ereignissen finden Sie unter behandeln und Auslösen von Ereignissen.

Gilt für: