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);
};
}}这是微软的代码 我在form1里加了个 tableLayoutPanel有在 form1类后并上它 怎么它没有反映!!
{
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);
};
}}这是微软的代码 我在form1里加了个 tableLayoutPanel有在 form1类后并上它 怎么它没有反映!!
生产DLL添加到form中
private void tableLayoutPanel1_CellPaint(object sender, TableLayoutCellPaintEventArgs e)
{
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); }
你+这个事件不完事了!!