winform中DataGridView控件绑定如下图所示的序号(第一列的序号):
后台代码如下:
private void dgvQueue_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
//绘制序号
using (SolidBrush b = new SolidBrush(System.Drawing.Color.DarkRed))
{
e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture),
e.InheritedRowStyle.Font, b,
e.RowBounds.Location.X + 10,
e.RowBounds.Location.Y + 4);
}
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。