zoukankan      html  css  js  c++  java
  • wpf 处理获取鼠标点击方法

    this.SourceInitialized += new EventHandler(win_SourceInitialized); //这里写在构造函数里

         void win_SourceInitialized(object sender, EventArgs e)
            {

                HwndSource hwndSource = PresentationSource.FromVisual(this) as HwndSource;
                if (hwndSource != null)
                {
                    hwndSource.AddHook(new HwndSourceHook(WindowProc));
                }
            }

     protected virtual IntPtr WindowProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
            {
                switch (msg)
                {
                    case 0x0201:

                        //MessageBox.Show("鼠标按下!");
                        Count = 0;
                        break;
                }

                return IntPtr.Zero;
            }

  • 相关阅读:
    假期十一
    假期十
    假期九
    假期八
    假期七
    假期六
    假期五
    假期四
    2020.02.11
    2020.02.10
  • 原文地址:https://www.cnblogs.com/guiqiang/p/4551954.html
Copyright © 2011-2022 走看看