TableLayoutCellPaintEventArgs Clase

Definición

Proporciona datos para el 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
Herencia
TableLayoutCellPaintEventArgs

Ejemplos

En el ejemplo siguiente se muestra cómo TableLayoutCellPaintEventArgs personalizar la apariencia de un TableLayoutPanel control . Este ejemplo de código forma parte de un ejemplo más grande proporcionado para el TableLayoutPanel control .

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

Comentarios

La TableLayoutCellPaintEventArgs clase proporciona información sobre la fila, la columna y los límites de la celda para admitir la pintura de la celda de la tabla.

Constructores

TableLayoutCellPaintEventArgs(Graphics, Rectangle, Rectangle, Int32, Int32)

Inicializa una nueva instancia de la clase TableLayoutCellPaintEventArgs.

Propiedades

CellBounds

Obtiene el tamaño y ubicación de la celda.

ClipRectangle

Obtiene el rectángulo en el que se va a pintar.

(Heredado de PaintEventArgs)
Column

Obtiene la columna de la celda.

Graphics

Obtiene los gráficos que se utilizan para pintar.

(Heredado de PaintEventArgs)
Row

Obtiene la fila de la celda.

Métodos

Dispose()

Libera todos los recursos que usa PaintEventArgs.

(Heredado de PaintEventArgs)
Dispose(Boolean)

Libera los recursos no administrados que usa PaintEventArgs y, de forma opcional, libera los recursos administrados.

(Heredado de PaintEventArgs)
Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Implementaciones de interfaz explícitas

IDeviceContext.GetHdc()

Devuelve el identificador de un contexto de dispositivo de Windows.

(Heredado de PaintEventArgs)
IDeviceContext.ReleaseHdc()

Libera el identificador de un contexto de dispositivo de Windows.

(Heredado de PaintEventArgs)

Se aplica a

Consulte también