zoukankan      html  css  js  c++  java
  • WPF button 如何区分click和doubleclick

    WPF button 同时处理两个事件时候会先触发click事件,触发doubleclick事件  ,那如何区分呢,可以这样设置:

      private static DispatcherTimer myClickWaitTimer =
                new DispatcherTimer(
                    new TimeSpan(0, 0, 0, 1),
                    DispatcherPriority.Background,
                    mouseWaitTimer_Tick,
                    Dispatcher.CurrentDispatcher);

            private void Button_MouseDoubleClick(object sender, MouseButtonEventArgs e)
            {
                // Stop the timer from ticking.
                myClickWaitTimer.Stop();

                Trace.WriteLine("Double Click");
                e.Handled = true;
            }

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                myClickWaitTimer.Start();
            }

            private static void mouseWaitTimer_Tick(object sender, EventArgs e)
            {
                myClickWaitTimer.Stop();

                // Handle Single Click Actions
                Trace.WriteLine("Single Click");
            }

  • 相关阅读:
    装饰器的用法——用装饰器来记录函数被调用的次数
    类和对象(上) C++
    数据结构—树(二叉树)
    数据结构—顺序表
    c++入门

    Cypress博客
    自动化测试框架总结2
    前端测试框架Jest总结
    关于redux和react书籍源码系列代码
  • 原文地址:https://www.cnblogs.com/honeymoon/p/3422409.html
Copyright © 2011-2022 走看看