我想在datagridview上禁用单击右键,
并仅通过双击
选择行Datadridview属性:
1.Fullrowselect
2.no multiselect
My Code:
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
dgvindex = dataGridView1.CurrentRow.Index;
}
private void dataGridView1_SelectionChanged(object sender, EventArgs e)
{
if (dataGridView1.CurrentRow.Index != dgvindex)
{
dataGridView1.Rows[dgvindex].Selected = true;
dataGridView1.CurrentCell = dataGridView1.Rows[dgvindex].Cells[0];
}
}
但是当我双击行
时它会卡住我想在双击时右键单击
设置当前行并在右键单击
时打开ContexMenuStrip请给我一些建议
我该怎么办?