DataGridView控件右键选中行

现在就只发现使用DataGridView的CellMouseDown事件来实现右键选中行。您是否还有更好的方法呢?一起探讨!!!
private void dgvTest_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex == -1 || e.ColumnIndex == -1)
                return;

            if (e.Button == MouseButtons.Right)
            {
                    DataGridView dgv = (DataGridView)sender;
                    dgv.ClearSelection();
                    //使用这条语句需要设置MultiSelect=false
                    //dgv.CurrentRow.Selected = false;
                    dgv.Rows[e.RowIndex].Selected = true;
            }
        }
原文地址:https://www.cnblogs.com/BlueBeauty/p/1977603.html