Share via


TableLayoutCellPaintEventArgs Kelas

Definisi

Menyediakan data untuk peristiwa tersebut 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
Warisan
TableLayoutCellPaintEventArgs

Contoh

Contoh berikut menunjukkan cara mengkustomisasi TableLayoutCellPaintEventArgs tampilan TableLayoutPanel kontrol. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk TableLayoutPanel kontrol.

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

Keterangan

Kelas TableLayoutCellPaintEventArgs menyediakan informasi tentang baris, kolom, dan batas sel untuk mendukung lukisan sel dalam tabel.

Konstruktor

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

Menginisialisasi instans baru kelas TableLayoutCellPaintEventArgs.

Properti

CellBounds

Mendapatkan ukuran dan lokasi sel.

ClipRectangle

Mendapatkan persegi panjang untuk dicat.

(Diperoleh dari PaintEventArgs)
Column

Mendapatkan kolom sel.

Graphics

Mendapatkan grafik yang digunakan untuk melukis.

(Diperoleh dari PaintEventArgs)
Row

Mendapatkan baris sel.

Metode

Dispose()

Merilis semua sumber daya yang PaintEventArgsdigunakan oleh .

(Diperoleh dari PaintEventArgs)
Dispose(Boolean)

Merilis sumber daya tidak terkelola yang digunakan oleh PaintEventArgs dan secara opsional merilis sumber daya terkelola.

(Diperoleh dari PaintEventArgs)
Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Implementasi Antarmuka Eksplisit

IDeviceContext.GetHdc()

Mengembalikan handel ke konteks perangkat Windows.

(Diperoleh dari PaintEventArgs)
IDeviceContext.ReleaseHdc()

Merilis handel konteks perangkat Windows.

(Diperoleh dari PaintEventArgs)

Berlaku untuk

Lihat juga