怎样可以dataGridView的第一列中显示这一行是第几条记录?
小弟相求……………………………………怎样可以dataGridView的第一列中显示这一行是第几条记录? --------------------编程问答-------------------- private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.ColumnIndex == -1 && e.RowIndex > -1)
{
StringFormat sf = new StringFormat(StringFormat.GenericDefault);
sf.Alignment = StringAlignment.Center;
e.PaintBackground(e.CellBounds, true);
e.Graphics.DrawString((e.RowIndex + 1).ToString(), this.Font,
new SolidBrush(Color.Black), e.CellBounds,sf);
e.Handled = true;
}
} --------------------编程问答--------------------
补充:.NET技术 , C#