Hello,
Is there a way to know which mouse button has been used when the double click events (DoubleClickRow, DoubleClickCell...) fire? So far, I didn't find any... This is really annoying to have the same behaviour for every button!
Best regards,
Damien
If the events don't expose the button, then you will probably need to store the last button clicked in the MouseDown event and use that.
I am trying to work out in during the ClickCell event if it has occured due to left click.
From the suggestion above, I don't understand why the users of the control need to maintain the state of Mouse. The control exposes 'MouseButtons' property . So at any point if I want to check this MouseButton state are inspect this property. Why is this not available on the grid?
How do I reset the state? MouseUp event. Then I have to track if the move has left the control.
Hi,
BB said:From the suggestion above, I don't understand why the users of the control need to maintain the state of Mouse. The control exposes 'MouseButtons' property . So at any point if I want to check this MouseButton state are inspect this property. Why is this not available on the grid?
I don't understand what you are asking here.
Yes, there is a static MouseButtons property on the Control class. So you could use this to determine which mouse button is down in the Click event. But I'm not sure this is 100% reliable. The click event might not fire until after the mouse is released, in which case, MouseButtons would not help.
But if it's working for you, then go ahead and use it. :)
As for why there is no MouseButtons property on the grid - why would there be? It would be redundant to copy the same method onto every control.
BB said:How do I reset the state? MouseUp event. Then I have to track if the move has left the control.
Why would you need to reset the state? If the user clicks the button a second time, then the MouseDown event would have to have fired again and the state would be updated. There's no reason why you would even need to reset the state.