1、设置选择模式
this.DataGridView_1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
2、添加CellMouseDown事件
if (e.Button == MouseButtons.Right) { if (e.RowIndex >= 0) { DataGridView_1.ClearSelection(); DataGridView_1.Rows[e.RowIndex].Selected = true; DataGridView_1.CurrentCell = dgItems.Rows[e.RowIndex].Cells[e.ColumnIndex]; } }