//添加下面事件即可
private void DataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex >= 0)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
this.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
}
}
}
private void DataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.RowIndex >= 0)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
this.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
}
}
}