Hello all,
I am currently working in a project that is developed based .NET FrameWork, recently I have faced with a problem is how to identify a single click with a double click in C#. Anyone can share your experience with us?
Thank in advance
Printable View
Hello all,
I am currently working in a project that is developed based .NET FrameWork, recently I have faced with a problem is how to identify a single click with a double click in C#. Anyone can share your experience with us?
Thank in advance
Hi,
if you need it for window-forms or other elements you can add
mouse-event-handler like the DoubleClick-Event-handler or MouseDown-Event-Handler;
you can add this things with the properties if you use .NET Studio from Microsoft ( klick onto the icon with the yellow flash, search the right event you need, doubleclick on it and the handler will be created automatically ).
have a nice day and blue skies
Hello,
:-), I suspect you thought me as a newbie. In .NET (C#), before the DoubleClick event occurred, then the Click event fired off, so the question I want to ask is, how to handle this case.
I wonder why people use Click events :) when there is such a beautiful thing named MouseDown and MouseUp. I never use click.
so, it will solve your problem too...
but i hope there are other ways out too... but no known to me.
sowwy!
that mouseeventargs have a parameter named "Clicks"...
catch the bird...
Hi, I hope it's ok bumping the thread, since I have the same problem.
I have a treeview and don't want the Click event to be fired when treeview is doubleclicked. Unfortunately, neither MouseUp, nor MouseEventArgs.Clicks don't help me. :(
Maybe someone can help me?
Thanks.
Maybe you can use MoudeDown event instead of MouseClick event and there you can check for doubleClicksQuote:
Originally Posted by gecka
Hopefully this helps :wave:Code:private void textBox1_MouseDown(object sender, MouseEventArgs e) {
if (e.Clicks > 1) {
return;
}
// your code you normally would do in the clickevent comes here
}