TableLayoutCellPaintEventArgs.Column Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the column of the cell.
public:
property int Column { int get(); };
public int Column { get; }
member this.Column : int
Public ReadOnly Property Column As Integer
Property Value
The column position of the cell.
Examples
The following example shows how to a TableLayoutCellPaintEventArgs to customize the appearance of a TableLayoutPanel control. This code example is part of a larger example provided for the TableLayoutPanel control.
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
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET