TableLayoutCellPaintEventArgs Classe

Definição

Fornece dados para o CellPaint evento.

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
Herança
TableLayoutCellPaintEventArgs

Exemplos

O exemplo seguinte mostra como TableLayoutCellPaintEventArgs personalizar a aparência de um TableLayoutPanel controlo. Este exemplo de código faz parte de um exemplo maior fornecido para o TableLayoutPanel controlo.

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

Observações

A TableLayoutCellPaintEventArgs classe fornece informações sobre a linha, coluna e limites da célula para suportar a pintura da célula na tabela.

Construtores

Name Description
TableLayoutCellPaintEventArgs(Graphics, Rectangle, Rectangle, Int32, Int32)

Inicializa uma nova instância da TableLayoutCellPaintEventArgs classe.

Propriedades

Name Description
CellBounds

Obtém o tamanho e a localização da célula.

ClipRectangle

Obtém o retângulo para pintar.

(Herdado de PaintEventArgs)
Column

Recebe a coluna da célula.

Graphics

Fica com os gráficos usados para pintar.

(Herdado de PaintEventArgs)
Row

Fica na fila da cela.

Métodos

Name Description
Dispose()

Liberta todos os recursos utilizados pelo PaintEventArgs.

(Herdado de PaintEventArgs)
Dispose(Boolean)

Liberta os recursos não geridos usados pelo PaintEventArgs e opcionalmente liberta os recursos geridos.

(Herdado de PaintEventArgs)
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como função de hash predefinida.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do atual Object.

(Herdado de Object)
ToString()

Devolve uma cadeia que representa o objeto atual.

(Herdado de Object)

Aplica-se a

Ver também