I need to Distinguish Between Clicks and Double-Clicks and I have used this solution with the timer msdn.doubleclick
so I have a Timer function who looks something like this
private void doubleClickTimer_Tick(object sender, EventArgs e)
{
milliseconds += 100;
if (milliseconds >= SystemInformation.DoubleClickTime)
{
doubleClickTimer_.Stop();
if (isDoubleClick)
executeDoubleClick();
else
ExecuteSingleClick();
isFirstClick = true;
isDoubleClick = false;
}
}
and this works ok, but in the ExecuteSingleClick I need the MouseEventArgs e, but all I have is the EventArgs e from the doubleClickTimer function, is there someway to get the MouseEventArgs from the doubleClickTimer so I can write like this:
ExecuteSingleClick(MouseEventArgs e)
{
MouseButton button = e.button;
....
}
Before you start the timer, set its tag property to the mouseeventargs
parameter (e
). You can then use this in the timer.tick
event callback (pass it to your execute(double)click functions).