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 TableLayoutCellPaintEventArgs přizpůsobit vzhled TableLayoutPanel ovládacího prvku. Tento příklad kódu je součástí většího příkladu 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 malování buňky v tabulce.

Konstruktory

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

Inicializuje novou instanci TableLayoutCellPaintEventArgs třídy .

Vlastnosti

CellBounds

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

ClipRectangle

Získá obdélník, ve kterém má 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

Dispose()

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

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

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

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

Určí, zda se zadaný objekt rovná aktuálnímu objektu.

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

Slouží jako výchozí hashovací funkce.

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

Type Získá z aktuální instance.

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

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

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

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

(Zděděno od Object)

Explicitní implementace rozhraní

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é