TableLayoutCellPaintEventArgs Klasa

Definicja

Udostępnia dane dla zdarzenia 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
Dziedziczenie
TableLayoutCellPaintEventArgs

Przykłady

W poniższym przykładzie pokazano, jak TableLayoutCellPaintEventArgs dostosować wygląd kontrolki TableLayoutPanel . Ten przykład kodu jest częścią większego przykładu udostępnionego dla kontrolki TableLayoutPanel .

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

Uwagi

Klasa TableLayoutCellPaintEventArgs zawiera informacje o wierszu, kolumnie i granicach komórki w celu obsługi malowania komórki w tabeli.

Konstruktory

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

Inicjuje nowe wystąpienie klasy TableLayoutCellPaintEventArgs.

Właściwości

CellBounds

Pobiera rozmiar i lokalizację komórki.

ClipRectangle

Pobiera prostokąt, w którym ma być malowany.

(Odziedziczone po PaintEventArgs)
Column

Pobiera kolumnę komórki.

Graphics

Pobiera grafikę używaną do malowania.

(Odziedziczone po PaintEventArgs)
Row

Pobiera wiersz komórki.

Metody

Dispose()

Zwalnia wszelkie zasoby używane przez element PaintEventArgs.

(Odziedziczone po PaintEventArgs)
Dispose(Boolean)

Zwalnia zasoby niezarządzane używane przez element PaintEventArgs i opcjonalnie zwalnia zasoby zarządzane.

(Odziedziczone po PaintEventArgs)
Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

Type Pobiera bieżące wystąpienie.

(Odziedziczone po Object)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)

Jawne implementacje interfejsu

IDeviceContext.GetHdc()

Zwraca uchwyt do kontekstu urządzenia z systemem Windows.

(Odziedziczone po PaintEventArgs)
IDeviceContext.ReleaseHdc()

Zwalnia uchwyt kontekstu urządzenia z systemem Windows.

(Odziedziczone po PaintEventArgs)

Dotyczy

Zobacz też