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

DataGridView展示行号

2012-12-22 
DataGridView显示行号? //显示行号private void dataGridView1_RowPostPaint(object sender, DataGridView

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);        }

热点排行