C#中datagirdview表头变换

关键代码:nextIndex变量为下一行的下标

dataGridView1.CurrentRow.Selected = false;

dataGridView1.Rows[nextIndex].Selected = true;

dataGridView1.CurrentCell = dataGridView1.Rows[nextIndex].Cells[0];//这句语句为重点,将下一行的Celll[0]赋给dataGridView1当前的表头

你可能感兴趣的:(C#中datagirdview表头变换)