WPF.双击事件

WPF双击事件 别走弯路-CSDN论坛.html(https://bbs.csdn.net/topics/392493855?list=2474794

private void MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            switch (e.ClickCount)
            {
                case 1://单击
                    {
                        NativeMethods.SendMessage(Hwnd, (int)WindowMessages.WM_NCLBUTTONDOWN, (IntPtr)HitTest.HTCAPTION, IntPtr.Zero);
                        break;
                    }
                case 2://双击
                    {
                        WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
                        break;
                    }
            }

 

posted @ 2022-08-12 15:14  多见多闻  阅读(435)  评论(0编辑  收藏  举报