tmostad
asked on
Intercept mouse_down event over DataGridView?
I've drawn a square (in the DGV_Paint sub) on top of a DataGridView control and when I click on it I don't want the underlying DataGridView to see the click event. Ideally there would be an e.handled property for mouse_down but there isn't. What I get is a cell_changed event in the DataGridView control which is causing me problems. There are some rather ugly ways around this but I am looking for something prettier.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry, I meant CurrentCellChanged event. I used that event to do stuff when the user actually wants to change cells not when the square above the DGV is clicked.
Private Sub DataGrid1_CurrentCellChang ed(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.CurrentCellChang ed
If DataGrid1.MouseButtons = MouseButtons.Left Then
MsgBox("left mouse button pressed")
End If
End sub
If DataGrid1.MouseButtons = MouseButtons.Left Then
MsgBox("left mouse button pressed")
End If
End sub
in case this helps,
Mouse events occur in the following order:
MouseEnter
MouseMove
MouseHover / MouseDown / MouseWheel
MouseUp
MouseLeave