zoukankan      html  css  js  c++  java
  • 如何实现伪双击事件

    大体都是用两次单击的时间差来判断一下是否是双击。

    SystemInformation.DoubleClickTime默认是500

    第一种方式:可以参考http://blog.csdn.net/zbssoft/article/details/5602658

     DateTime   lastDownTime   =   DateTime.Now;   
      private   void   comboBox1_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;   
      }  
     

    Derexpress中的TreeList控件触发双击事件的时候,总会触发单击事件。为了处理单击和双击的时候分别处理不同的代码,解决方案如何:

    第二种方式:http://www.devexpress.com/Support/Center/p/S136873.aspx。记得是在Timer控件的Interval 属性为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 timer1_Tick(object sender, EventArgs e)    {
                timer1.Stop();
                if (needHandleMouseClick)   {
                    // your code here
                    
    //...
                    
    // wbDokument.Navigate(file);
                }
                needHandleMouseClick = true;
            }
  • 相关阅读:
    把函数作为参数,调用的时候,先判断这个参数是不是存在,然后调用函数的时候加上()
    @keyframes 和animation配合使用
    让sublime text3支持Vue语法高亮显示
    vue.js中的vue-cli中各个文件简单介绍
    函数节流
    Ajax原理
    Ajax同步
    判断数据类型的方法
    闭包的用途
    vue模板编译
  • 原文地址:https://www.cnblogs.com/51net/p/2573378.html
Copyright © 2011-2022 走看看