I with this code marking the first column from DataGridView
:
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
dataGridView1.Rows[i].HeaderCell.Value = (i + 1).ToString();
}
but because the low width, the numbers are not shown properly, how can I change the width the first column ?
Image:
You have to set an appropriate DataGridViewRowHeadersWidthSizeMode
value to RowHeadersWidthSizeMode
.
For example:
dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders;