













private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex == -1 )//如果单击列表头,全选.
{
int i;
for (i = 0; i < this.dataGridView1.RowCount; i++)
{
this.dataGridView1.EndEdit();//结束编辑状态.
string re_value = this.dataGridView1.Rows[i].Cells[0].EditedFormattedValue.ToString();
this.dataGridView1.Rows[i].Cells[0].Value = "true";//如果为true则为选中,false未选中
this.dataGridView1.Rows[i].Selected = true;//选中整行。
}
}
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。