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

次の例では、 を使用して TableLayoutCellPaintEventArgs コントロールの外観をカスタマイズする方法を TableLayoutPanel 示します。 このコード例は、 コントロールに対して提供されるより大きな例の 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)

明示的なインターフェイスの実装

IDeviceContext.GetHdc()

Windows デバイス コンテキストを識別するハンドルを返します。

(継承元 PaintEventArgs)
IDeviceContext.ReleaseHdc()

Windows デバイス コンテキストのハンドルを解放します。

(継承元 PaintEventArgs)

適用対象

こちらもご覧ください