• C#运行时鼠标移动控件


            [System.Runtime.InteropServices.DllImport("user32.dll")]
            public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
            [System.Runtime.InteropServices.DllImport("user32.dll")]
            public static extern bool ReleaseCapture();
    
            private void MoveControl(Control sender, MouseEventArgs e)
            {
                if (e.Button == MouseButtons.Left && e.Clicks == 1)
                {
                    ReleaseCapture();
                    SendMessage(sender.Handle, 161, 2, 0);
                    SendMessage(sender.Handle, 0x0202, 0, 0);
                }
                else
                {
                    //添加双击或右击代码……
                }
            }
    
            private void button3_MouseDown(object sender, MouseEventArgs e)
            {
                MoveControl(sender as Control, e);
            }
  • 相关阅读:
    蛋糕多少钱?
    【FJOI2015】金币换位问题
    撞车
    【BZOJ 1097】旅游景点atr
    codeforces 434D
    codeforces 480D
    bzoj网络流
    bzoj2039
    bzoj1927
    bzoj1070
  • 原文地址:https://www.cnblogs.com/ZC_Mo-Blog/p/5874487.html
Copyright © 2020-2023  润新知