日期:2014-05-17 浏览次数:20788 次
private void dgvList_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (e.RowIndex >= 0) { if (dgvList.Rows[e.RowIndex].Selected == false) { dgvList.ClearSelection(); dgvList.Rows[e.RowIndex].Selected = true; } if (dgvList.SelectedRows.Count == 1 && e.ColumnIndex != -1) { dgvList.CurrentCell = dgvList.Rows[e.RowIndex].Cells[e.ColumnIndex]; } } } }