TableLayoutPanel.OnCellPaint メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
使用例OnCellPaint メソッドをオーバーライドして、セルのカスタムの外観を作成する方法を次のコード例に示します。
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 Not c Is 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
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); }; } }
プラットフォームWindows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照Weblioに収録されているすべての辞書からTableLayoutPanel.OnCellPaint メソッドを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からTableLayoutPanel.OnCellPaint メソッド
を検索
- TableLayoutPanel.OnCellPaint メソッドのページへのリンク