TableLayoutCellPaintEventArgs (Clase) (System.Windows.Forms)

Cambiar vista:
Sin script
Biblioteca de clases de .NET Framework
TableLayoutCellPaintEventArgs (Clase)

Actualización: noviembre 2007

Proporciona datos del evento CellPaint.

Espacio de nombres:  System.Windows.Forms
Ensamblado:  System.Windows.Forms (en System.Windows.Forms.dll)
Sintaxis

Visual Basic (Declaración)
Public Class TableLayoutCellPaintEventArgs _
	Inherits PaintEventArgs
Visual Basic (Uso)
Dim instance As TableLayoutCellPaintEventArgs
C#
public class TableLayoutCellPaintEventArgs : PaintEventArgs
Visual C++
public ref class TableLayoutCellPaintEventArgs : public PaintEventArgs
J#
public class TableLayoutCellPaintEventArgs extends PaintEventArgs
JScript
public class TableLayoutCellPaintEventArgs extends PaintEventArgs
Comentarios

La clase TableLayoutCellPaintEventArgs proporciona información sobre la fila, columna y límites de la celda para admitir que se dibuje la celda en la tabla.

Ejemplos

En el ejemplo siguiente se muestra cómo usar TableLayoutCellPaintEventArgs para personalizar el aspecto de un control TableLayoutPanel. Este ejemplo de código forma parte de un ejemplo más extenso referente al control TableLayoutPanel.

Visual Basic
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


C#
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);
        };
	}

}


Jerarquía de herencia

System.Object
  System.EventArgs
    System.Windows.Forms.PaintEventArgs
      System.Windows.Forms.TableLayoutCellPaintEventArgs
Seguridad para subprocesos

Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.
Plataformas

Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión

.NET Framework

Compatible con: 3.5, 3.0, 2.0
Vea también

Referencia