将DataGridView的MultiSelect属性设置为:true
然后设置:SelectionChanged事件。如:
private void dgvCustomer_SelectionChanged(object sender, EventArgs e)
{
labRowSelectCount.Text = dgvCustomer.SelectedRows.Count.ToString();
for (int i = 0; i < dgvCustomer.Rows.Count; i++)
{
dgvCustomer.Rows[i].Cells[0].Value = dgvCustomer.Rows[i].Selected;
}
}