I am working on project in which I have a datagridview containing normal textbox cells & comboboxcells too, I can catch mouseDoubleClick
event in normal textbox cells from datagridview's MouseDoubleClick
event handler. But I have no idea about how to fire & catch DataGridViewComboBoxCell.MouseDoubleClick event
.
Please, help me how to accomplish it.
ComboBoxes, real or in dgv columns do not support doubleclicks. So you should not try to make it work here when it won't work in the rest of windows!
I suggest using a different user action; clicking with the right button comes to mind. It usually brings up a context-sensitive menu, so it seems a good choice..
I use the HitTest
function to find the cell since a ComboBoxColumn
can make it hard to determine the cell that was hit..
private void dataGridView1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button.HasFlag(MouseButtons.Right))
{
DataGridView.HitTestInfo hit = dataGridView1.HitTest(e.X, e.Y);
DataGridViewCell cell = dataGridView1[hit.ColumnIndex, hit.RowIndex];
// call some event..
yourInfoAction(cell.Value);
}
}