dataGridView右键选中行
给DataDridView添加CellMouseClick事件
完整代码如下
private void dgvw_Books_List_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if (e.Button == MouseButtons.Right) { if (e.RowIndex >= 0) { dgvw_Books_List.ClearSelection(); dgvw_Books_List.Rows[e.RowIndex].Selected = true; dgvw_Books_List.CurrentCell = dgvw_Books_List.Rows[e.RowIndex].Cells[e.ColumnIndex]; cms_Edit.Show(MousePosition.X, MousePosition.Y); } } }
tick
2008-11-27 上午 5:35
:em45: