Try:
private void Form1_Load(object sender, EventArgs e){
this.dataGridView1.AllowUserToAddRows = false;
for (int i = 0; i < 20; i++) // 假定需要显示20行空表格,具体根据需要修改此处
{
脊禅橡袭局 this.dataGridView1.Rows.Add(new DataGridViewRow());
}
foreach (DataGridViewRow row in this.dataGridView1.Rows)
{
row.HeaderCell.Value = String.Format("{0}", row.Index + 1);
樱旁 }
}