解决方案 »

  1.   

    楼主,我也遇到你的这个问题了,我的需要是点击控件后让它移动,有一个办法可以试试:
        public partial class Form1 : Form
        {
            const uint WM_SYSCOMMAND = 0x0112;
            const uint SC_MOVE = 0xF010;
            const uint HTCAPTION = 0x0002;        [DllImport("user32.dll", EntryPoint = "SendMessageA")]
            private static extern int SendMessage(IntPtr hwnd, uint wMsg, uint wParam, uint lParam);
            [DllImport("user32.dll")]
            private static extern int ReleaseCapture();
            [DllImport("user32.dll")]
            private static extern int SetCapture(IntPtr hwnd);
                    public Form1()
            {
                InitializeComponent();
                this.ShowInTaskbar = false;
            }        private void button1_Click(object sender, EventArgs e)
            {
                
            }        private void pictureBox2_MouseDown(object sender, MouseEventArgs e)
            {
                ReleaseCapture();
                SendMessage((sender as Control).Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);//这里直到移动结束才返回
                Console.WriteLine("oo");
                pictureBox2.Left = plBody.Left;
            }
        }
    为什么跟不上鼠标的移动呢?我的是Location不对,希望有人指点一下,
      

  2.   

    跟随鼠标textbox还怎么获得焦点输入啊?
    如果实在没辙了就隐藏textbox用gdi+画个假的