- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
private void DBGridCategories_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
int rowsCount = (sender as DataGridView).RowCount;
if ((rowsCount >= 0) && (rowsCount < 100))
{
(sender as DataGridView).RowHeadersWidth = 30;
}
else
{
if ((rowsCount >= 100) && (rowsCount < 1000))
{
(sender as DataGridView).RowHeadersWidth = 40;
}
else
{
if ((rowsCount >= 1000) && (rowsCount < 10000))
{
(sender as DataGridView).RowHeadersWidth = 50;
}
else
{
if ((rowsCount >= 10000) && (rowsCount < 100000))
{
(sender as DataGridView).RowHeadersWidth = 65;
}
}
}
}
using (SolidBrush brush = new SolidBrush(Color.Red))
{
e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture) + ".", e.InheritedRowStyle.Font, brush, e.RowBounds.Location.X + 10, e.RowBounds.Location.Y + 1);
}
}
Govnocoder#0xFF 02.12.2010 20:14 # +1
absolut 02.12.2010 22:24 # 0
А почему аффтар не рассмотрел вариант rowsCount >= 100000 ?
Pauchok-Anaynckiy 03.12.2010 00:28 # +1
Govnoeb 06.12.2010 12:55 # −2
Maxim546 06.12.2010 13:04 # −1