嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 6 元微信扫码支付:6 元
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
	WPF鼠标点击控件或元素,直接拖动,显示拖动效果,拖动图可以是原控件,也可自己定义
	
	   private void panelDrag_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed )
            {
                Win32.POINT point = new Win32.POINT();
                if (m_bIniMouseCap == false)
                {
                    Win32.GetCursorPos(ref point);
                    if (Math.Abs(point.x - _currPoint.x) > 0.2 || Math.Abs(point.y - _currPoint.y) > 0.2)
                    {
                        m_bIniMouseCap = true;
                        if (Mouse.Captured == null) Mouse.Capture(panelDrag);
                    }
                    else
                        return;
                }
                Win32.GetCursorPos(ref point);
                _currPoint = point;
	                popTree.IsOpen = true;
                UpdateWindow(point);
	            }
            else
            {
                m_bIniMouseCap = false;
	                if (Mouse.Captured != null)
                {
                    Mouse.Capture(null);
                    //Mouse.AddMouseUpHandler(sender, e);
                    popTree.IsOpen = false;
	                    /*
                    System.Windows.Forms.Integration.WindowsFormsHost ui = null;
	                    if (ui != null)
                    {
	                        // HwndSource hwndSource = PresentationSource.FromVisual(wndParent.gridContent.Children[0]) as HwndSource;
                        //Point pp=Mouse.GetPosition(wndParent.gridContent);
                        //Point pw= wndParent.gridContent.PointToScreen(pp);
                        //hwndSource = (HwndSource)PresentationSource.FromDependencyObject(this.Child);
                        //var hwnd = hwndSource.Handle;
                        //Win32.RECT rect;
                        //Win32.GetWindowRect(hwnd, out rect);
                        //求得控件相对于窗体的位置
                        Window window = Window.GetWindow(ui);
                        Point point = ui.TransformToAncestor(window).Transform(new Point(0, 0));
	                        if (point.Y   window.Top < _currPoint.y && point.Y   window.Top   ui.ActualHeight > _currPoint.y && point.X    window.Left   10 < _currPoint.x && point.X    window.Left   ui.ActualWidth > _currPoint.x)
                        {
                          
                            Win32.mouse_event((int)(Win32.MouseEventFlags.LeftUp), 0, 0, 0, IntPtr.Zero);
}
	                    }//*/
                }
	            }
        }