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");
            }

  • 相关阅读:
    0 MATLAB的基本语法测试(7.20)
    eclipse(java)安装swing designer
    Request的用法
    requests模拟登陆的三种方式
    requests模块使用代理
    利用Python爬取翻译网站的翻译功能
    request发送带headers和带参数的请求
    爬虫的介绍和概念
    ROBOTS协议
    爬虫的流程
  • 原文地址:https://www.cnblogs.com/honeymoon/p/3422409.html
Copyright © 2011-2022 走看看