简体   繁体   中英

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.

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.

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM