TableLayoutCellPaintEventArgs Classe

Definizione

Fornisce i dati per l'evento CellPaint.

public ref class TableLayoutCellPaintEventArgs : System::Windows::Forms::PaintEventArgs
public class TableLayoutCellPaintEventArgs : System.Windows.Forms.PaintEventArgs
type TableLayoutCellPaintEventArgs = class
    inherit PaintEventArgs
Public Class TableLayoutCellPaintEventArgs
Inherits PaintEventArgs
Ereditarietà
TableLayoutCellPaintEventArgs

Esempio

Nell'esempio seguente viene illustrato come personalizzare TableLayoutCellPaintEventArgs l'aspetto di un TableLayoutPanel controllo . Questo esempio di codice fa parte di un esempio più ampio fornito per il TableLayoutPanel controllo .

public class DemoTableLayoutPanel : TableLayoutPanel
{
    protected override void OnCellPaint(TableLayoutCellPaintEventArgs e)
    {
        base.OnCellPaint(e);

        Control c = this.GetControlFromPosition(e.Column, e.Row);

        if ( c != null )
        {
            Graphics g = e.Graphics;

            g.DrawRectangle(
                Pens.Red, 
                e.CellBounds.Location.X+1,
                e.CellBounds.Location.Y + 1,
                e.CellBounds.Width - 2, e.CellBounds.Height - 2);

            g.FillRectangle(
                Brushes.Blue, 
                e.CellBounds.Location.X + 1, 
                e.CellBounds.Location.Y + 1, 
                e.CellBounds.Width - 2, 
                e.CellBounds.Height - 2);
        };
    }
}
Public Class DemoTableLayoutPanel
    Inherits TableLayoutPanel

    Protected Overrides Sub OnCellPaint( _
    ByVal e As System.Windows.Forms.TableLayoutCellPaintEventArgs)

        MyBase.OnCellPaint(e)

        Dim c As Control = Me.GetControlFromPosition(e.Column, e.Row)

        If c IsNot Nothing Then
            Dim g As Graphics = e.Graphics

            g.DrawRectangle( _
            Pens.Red, _
            e.CellBounds.Location.X + 1, _
            e.CellBounds.Location.Y + 1, _
            e.CellBounds.Width - 2, _
            e.CellBounds.Height - 2)

            g.FillRectangle( _
            Brushes.Blue, _
            e.CellBounds.Location.X + 1, _
            e.CellBounds.Location.Y + 1, _
            e.CellBounds.Width - 2, _
            e.CellBounds.Height - 2)
        End If

    End Sub

End Class

Commenti

La TableLayoutCellPaintEventArgs classe fornisce informazioni sulla riga, la colonna e i limiti della cella per supportare il disegno della cella nella tabella.

Costruttori

Nome Descrizione
TableLayoutCellPaintEventArgs(Graphics, Rectangle, Rectangle, Int32, Int32)

Inizializza una nuova istanza della classe TableLayoutCellPaintEventArgs.

Proprietà

Nome Descrizione
CellBounds

Ottiene le dimensioni e la posizione della cella.

ClipRectangle

Ottiene il rettangolo in cui disegnare.

(Ereditato da PaintEventArgs)
Column

Ottiene la colonna della cella.

Graphics

Ottiene la grafica utilizzata per disegnare.

(Ereditato da PaintEventArgs)
Row

Ottiene la riga della cella.

Metodi

Nome Descrizione
Dispose()

Rilascia tutte le risorse usate da PaintEventArgs.

(Ereditato da PaintEventArgs)
Dispose(Boolean)

Rilascia le risorse non gestite usate da PaintEventArgs e, facoltativamente, rilascia le risorse gestite.

(Ereditato da PaintEventArgs)
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Implementazioni dell'interfaccia esplicita

Nome Descrizione
IDeviceContext.GetHdc()

Restituisce l'handle a un contesto di dispositivo Windows.

(Ereditato da PaintEventArgs)
IDeviceContext.ReleaseHdc()

Rilascia l'handle di un contesto di dispositivo Windows.

(Ereditato da PaintEventArgs)

Si applica a

Vedi anche