private void dGvCapacity_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs
e)
{
try
{
string
strRowNumber = (e.RowIndex + 1).ToString();
SizeF
size = e.Graphics.MeasureString(strRowNumber, this.Font);
if
(dGvCapacity.RowHeadersWidth < (int)(size.Width
+ 20))
{
dGvCapacity.RowHeadersWidth
= (int)(size.Width + 20);
}
Brush
b = SystemBrushes.ControlText;
e.Graphics.DrawString(strRowNumber, this.Font,
b, e.RowBounds.Location.X + 15, e.RowBounds.Location.Y + ((e.RowBounds.Height -
size.Height) / 2));
}
catch
(Exception ex)
{
}
}
No comments:
Post a Comment