C# Winforms difference between DoubleClick event and MouseDoubleClick event
Quick question here: As the title says, what's the difference between the two events?
As far as I开发者_运维百科 can tell, MouseDoubleClick
is inherited from Control
, while DoubleClick
is inherited from Component
, but is there any functional difference between the two?
Thanks
From the MSDN Documentation:
DoubleClick events are logically higher-level events of a control. They may be raised by other user actions, such as shortcut key combinations.
I believe the key difference between these two is the event handler where the "DoubleClick" event will include a simple EventArgs object while the "MouseDoubleClick" will include a MouseEventArgs which will include the position of the mouse among other things.
So basically if you need to know where the click occurred on the control, I would favor "MouseDoubleClick" over "DoubleClick".
DoubleClick
private void DoubleClick_Event(object sender, EventArgs e)
MouseDoubleClick
private void MouseDoubleClick_Event(object sender, MouseEventArgs e)
As you can see here: Control.MouseDoubleClick Event
The following series of events is raised by the control when such a user action takes place:
MouseDown event.
Click event.
MouseClick event.
MouseUp event.
MouseDown event.
DoubleClick event.
MouseDoubleClick event.
MouseUp event.
so there is a difference between the two as the MouseDoubleClick implies all these events to get triggered.
explain how these two pages and the differences between the two events
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doubleclick.aspx
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.mousedoubleclick.aspx
A double-click is determined by the mouse settings of the user's operating system.
The MouseDoubleClick event occurs when the user depresses a mouse button twice in quick succession when the cursor is over the control.
Regards.
精彩评论