日期:2014-05-17 浏览次数:21417 次
//全选
private void btnAllchoose_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
dataGridView1.Rows[i].Cells[0].Value = true;
}
}
//反选
private void btnRchose_Click(object sender, EventArgs e)
{
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
if ((Boolean)chk.EditedFormattedValue == true)
{
dataGridView1.Rows[i].Cells[0].Value = false;
}
else
dataGridView1.Rows[i].Cells[0].Value = true;
}
}