TableLayoutCellPaintEventArgs Třída

Definice

Poskytuje data pro událost 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
Dědičnost
TableLayoutCellPaintEventArgs

Příklady

Následující příklad ukazuje, jak přizpůsobit TableLayoutCellPaintEventArgs vzhled TableLayoutPanel ovládacího prvku. Tento příklad kódu je součástí většího příkladu zadaného TableLayoutPanel pro ovládací prvek.

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

Poznámky

Třída TableLayoutCellPaintEventArgs poskytuje informace o řádku, sloupci a hranici buňky pro podporu obrazu buňky v tabulce.

Konstruktory

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

Inicializuje novou instanci TableLayoutCellPaintEventArgs třídy.

Vlastnosti

Name Description
CellBounds

Získá velikost a umístění buňky.

ClipRectangle

Získá obdélník, ve kterém chcete malovat.

(Zděděno od PaintEventArgs)
Column

Získá sloupec buňky.

Graphics

Získá grafiku použitou k malování.

(Zděděno od PaintEventArgs)
Row

Získá řádek buňky.

Metody

Name Description
Dispose()

Uvolní všechny prostředky používané nástrojem PaintEventArgs.

(Zděděno od PaintEventArgs)
Dispose(Boolean)

Uvolní nespravované prostředky používané PaintEventArgs a volitelně uvolní spravované prostředky.

(Zděděno od PaintEventArgs)
Equals(Object)

Určuje, zda je zadaný objekt roven aktuálnímu objektu.

(Zděděno od Object)
GetHashCode()

Slouží jako výchozí funkce hash.

(Zděděno od Object)
GetType()

Získá Type aktuální instance.

(Zděděno od Object)
MemberwiseClone()

Vytvoří mělkou kopii aktuálního Object.

(Zděděno od Object)
ToString()

Vrátí řetězec, který představuje aktuální objekt.

(Zděděno od Object)

Explicitní implementace rozhraní

Name Description
IDeviceContext.GetHdc()

Vrátí popisovač kontextu zařízení s Windows.

(Zděděno od PaintEventArgs)
IDeviceContext.ReleaseHdc()

Uvolní popisovač kontextu zařízení s Windows.

(Zděděno od PaintEventArgs)

Platí pro

Viz také