private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
2         {
3             //自动编号,与数据无关
4              Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dataGridView1.RowHeadersWidth - 4, e.RowBounds.Height);
5             TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dataGridView1.RowHeadersDefaultCellStyle.Font, rectangle, dataGridView1.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
6         }

相关文章:

  • 2022-01-07
  • 2021-09-11
  • 2021-07-24
  • 2021-07-25
  • 2022-12-23
  • 2022-01-20
  • 2021-07-27
猜你喜欢
  • 2021-12-09
  • 2021-07-31
  • 2022-12-23
  • 2021-10-14
相关资源
相似解决方案