TableLayoutCellPaintEventArgs Classe

Definição

Fornece dados para o evento de 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
Herança
TableLayoutCellPaintEventArgs

Exemplos

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

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

Comentários

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

Construtores

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

Inicializa uma nova instância da classe TableLayoutCellPaintEventArgs.

Propriedades

CellBounds

Obtém o tamanho e o local da célula.

ClipRectangle

Obtém o retângulo a ser pintado.

(Herdado de PaintEventArgs)
Column

Obtém a coluna da célula.

Graphics

Obtém os elementos gráficos usados para pintar.

(Herdado de PaintEventArgs)
Row

Obtém a linha da célula.

Métodos

Dispose()

Libera todos os recursos usados pelo PaintEventArgs.

(Herdado de PaintEventArgs)
Dispose(Boolean)

Libera os recursos não gerenciados usados pelo PaintEventArgs e opcionalmente libera os recursos gerenciados.

(Herdado de PaintEventArgs)
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Implantações explícitas de interface

IDeviceContext.GetHdc()

Retorna o identificador de um contexto de dispositivo Windows.

(Herdado de PaintEventArgs)
IDeviceContext.ReleaseHdc()

Libera o identificador de um contexto de dispositivo Windows.

(Herdado de PaintEventArgs)

Aplica-se a

Confira também