TableLayoutCellPaintEventArgs クラス

定義

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
継承
TableLayoutCellPaintEventArgs

次の例は、TableLayoutPanel コントロールの外観をカスタマイズするTableLayoutCellPaintEventArgs方法を示しています。 このコード例は、 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

注釈

TableLayoutCellPaintEventArgs クラスは、テーブル内のセルの描画をサポートするために、セルの行、列、および境界に関する情報を提供します。

コンストラクター

名前 説明
TableLayoutCellPaintEventArgs(Graphics, Rectangle, Rectangle, Int32, Int32)

TableLayoutCellPaintEventArgs クラスの新しいインスタンスを初期化します。

プロパティ

名前 説明
CellBounds

セルのサイズと位置を取得します。

ClipRectangle

描画する四角形を取得します。

(継承元 PaintEventArgs)
Column

セルの列を取得します。

Graphics

描画に使用するグラフィックスを取得します。

(継承元 PaintEventArgs)
Row

セルの行を取得します。

メソッド

名前 説明
Dispose()

PaintEventArgsによって使用されるすべてのリソースを解放します。

(継承元 PaintEventArgs)
Dispose(Boolean)

PaintEventArgsによって使用されるアンマネージ リソースを解放し、必要に応じてマネージド リソースを解放します。

(継承元 PaintEventArgs)
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

適用対象

こちらもご覧ください