|
-
July 21st, 2003, 10:09 PM
#1
How to identify a single click with a double click in C#
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
-
July 22nd, 2003, 01:00 AM
#2
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
-
July 22nd, 2003, 01:55 AM
#3
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.
-
July 22nd, 2003, 04:02 AM
#4
i wonder
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!
If you think you CAN, you can, If you think you CAN'T, you are probably right.
Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
-
July 22nd, 2003, 04:06 AM
#5
forgot to tell you
that mouseeventargs have a parameter named "Clicks"...
catch the bird...
If you think you CAN, you can, If you think you CAN'T, you are probably right.
Have some nice Idea to share? Write an Article Online or Email to us and You may WIN a Technical Book from CG.
-
September 15th, 2007, 07:00 AM
#6
Re: How to identify a single click with a double click in C#
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.
Using .NET 2.0 
-
September 15th, 2007, 05:39 PM
#7
Re: How to identify a single click with a double click in C#
 Originally Posted by gecka
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 doubleClicks
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
}
Hopefully this helps
 Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|