事件:
this.View.DgvGra.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(DgvGradeInfoRowPostPaint);
方法
private void DgvGradeInfoRowPostPaint(object sender, System.Windows.Forms.DataGridViewRowPostPaintEventArgs e)
{
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
this.View.DgvStorageInfo.RowHeadersWidth - 4,
e.RowBounds.Height);
TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
this.View.DgvStorageInfo.RowHeadersDefaultCellStyle.Font,
rectangle,
this.View.DgvStorageInfo.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
网友评论