[ToolboxBitmap(typeof(DataGridView))]
public class DataGridViewEx : DataGridView
{
public DataGridViewEx()
: base()
{ }
protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, base.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, Convert.ToInt32(e.RowIndex + 1).ToString(), base.RowHeadersDefaultCellStyle.Font, rectangle, base.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
base.OnRowPostPaint(e);
}
}
public class DataGridViewEx : DataGridView
{
public DataGridViewEx()
: base()
{ }
protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, base.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, Convert.ToInt32(e.RowIndex + 1).ToString(), base.RowHeadersDefaultCellStyle.Font, rectangle, base.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
base.OnRowPostPaint(e);
}
}