public void ShowIndex(DataGridView dgv)
{
for (int i = 0; i < dgv.Rows.Count; i++)
{
dgv.Rows[i].HeaderCell.Value = (i+1).ToString(); //HeaderCell获取或设置行的标头单元格
}
}