Triple Mouse Click in C#?
Have a look at this: Mousebuttoneventargs.clickcount
That should cover it I suppose.
DO THIS:
private int _clicks = 0;
private System.Windows.Forms.Timer _timer = new System.Windows.Forms.Timer();
private void txtTextMessage_MouseUp(object sender, MouseEventArgs e)
{
_timer.Stop();
_clicks++;
if (_clicks == 3)
{
// this means the trip click happened - do something
txtTextMessage.SelectAll();
_clicks = 0;
}
if (_clicks < 3)
{
_timer.Interval = 500;
_timer.Start();
_timer.Tick += (s, t) =>
{
_timer.Stop();
_clicks = 0;
};
}
}
You just have to store the time when a double click occured in that Box. Then, in the handler for the single click, check if a double click happened not more than N milliseconds ago (N = 300 or so).
In this case, call your TripleClick() function directly or define a new event for you derived "TripleClickAwareTextBox".