首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

DataGridView增添索引

2012-12-24 
DataGridView添加索引??????? private void dataGridView1_RowPostPaint(object sender, DataGridViewRowP

DataGridView添加索引

??????? private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
??????? {
??????????? Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
??????????? e.RowBounds.Location.Y, dataGridView1.RowHeadersWidth - 4,
??????????? e.RowBounds.Height);
??????????? TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
??????????????? dataGridView1.RowHeadersDefaultCellStyle.Font, rectangle,
??????????????? dataGridView1.RowHeadersDefaultCellStyle.ForeColor,
??????????????? TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
??????? }

热点排行