C#中的datagridview显示行号
2015-05-07 16:43
405 查看
private void DGV_DataInfo_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
var dgv = sender as DataGridView;
if (dgv != null)
{
Rectangle rect = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dgv.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dgv.RowHeadersDefaultCellStyle.Font, rect, dgv.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
}
{
var dgv = sender as DataGridView;
if (dgv != null)
{
Rectangle rect = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, dgv.RowHeadersWidth - 4, e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(), dgv.RowHeadersDefaultCellStyle.Font, rect, dgv.RowHeadersDefaultCellStyle.ForeColor, TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
}
相关文章推荐
- C#让datagridview 显示行号
- C# DataGridView显示行号的三种方法
- C# DataGridView显示行号的三种方法
- C#中DataGridView显示行号
- C# 、Vb .Net 中 Datagridview显示行号方法。
- C# DataGridView显示行号、行选中
- C# 中 datagridview控件 在行标题显示行号的方法
- C# DataGridView显示行号方法。
- c#中dataGridView显示行号的方法
- C# winfrom中 DataGridView中显示行号
- C# DataGridView显示行号的三种方法
- C# DataGridView显示行号的两种方法
- C#dataGridView字体显示设置
- 让DataGridView显示行号
- Visual studio 2008环境配置:C#显示代码行号、全屏显示
- C#设置DataGridView控件的标题行的高度并且居中显示
- c#之combox下列列表框与datagridview及datagridviewtextboxcolumn关联显示
- C# 怎样让DataGridView不显示最下面那个空行
- DataGridView 显示行号
- DataGridView显示行号的几种方法来自http://www.soaspx.com/dotnet/csharp/csharp_20100204_2740.html