日期:2014-05-17 浏览次数:20959 次
dataGridView1.FirstDisplayedScrollingRowIndex
private void Form1_Load(object sender, System.EventArgs e)
{
dataGridView1.Dock = DockStyle.Fill;
dataGridView1.DataSource = System.Drawing.Imaging.ImageCodecInfo.GetImageDecoders();
}
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
System.Drawing.Rectangle rectangle = new System.Drawing.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);
}