How to implement a pseudo double-click event

Source: Internet
Author: User

Generally, the time difference between two clicks is used to determine whether it is a double-click.

Systeminformation. doubleclicktime is 500 by default.

The first way: you can refer to the http://blog.csdn.net/zbssoft/article/details/5602658

 

Datetime lastdowntime = datetime. now;
Private Void Combobox#mousedown ( Object Sender, mouseeventargs E)
{
Timespan sp = datetime. Now-lastdowntime;
If (Sp. milliseconds <= systeminformation. doubleclicktime)
{
System. Console. writeline ( " DoubleClick " );
}
Else
{
System. Console. writeline ( " Click " );
}
Lastdowntime = datetime. now;
}

 

 

When a double-click event is triggered by the treelist control in derexpress, the click event is always triggered. To process the differentCode, Solution:

Method 2: http://www.devexpress.com/support/center/p/s136873.aspx. Remember that the interval attribute of the timer control is 500

Bool Needhandlemouseclick = True ;
Private Void Tldokumente_mouseclick ( Object Sender, mouseeventargs e ){
Timer1.start ();
}

Private Void Treelist1_mousedoubleclick (Object Sender, mouseeventargs e ){
Needhandlemouseclick = False ;
// Perform your code here
// ...
// System. Diagnostics. process. Start (File );
}

Private Void Timereffectick ( Object Sender, eventargs e ){
Timer1.stop ();
If (Needhandlemouseclick ){
// Your code here
// ...
// Wbdokument. navigate (File );
}
Needhandlemouseclick = True ;
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.