我实现的是一个异形窗口(圆形),异形窗口的移动是在其鼠标事件中完成的,
拖动的时候如果完全在父窗口的PictureBox控件内就没有拖尾,如果移动至PicuteBox与其它控件的
交界处就有严重的拖尾,在其它控件的交接处,以及标题栏、工具栏与PictureBox等空间的交界处
拖尾现象也很严重,请问这是怎么回事?应该怎么解决?谢谢
主要代码如下:
public void ShapedForm_MouseDown(object sender, MouseEventArgs e)
        {
            bFormDragging = true;
            oPointClicked = new Point(e.X,e.Y);
        }        public void ShapedForm_MouseUp(object sender, MouseEventArgs e)
        {
            bFormDragging = false;
        }        public void ShapedForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (bFormDragging)
            {             
                oMoveToPoint = this.PointToScreen(new Point(e.X, e.Y));
                oMoveToPoint.Offset(oPointClicked.X * -1,
                    (oPointClicked.Y + SystemInformation.CaptionHeight +
                    SystemInformation.BorderSize.Height) * -1);
                this.Location = oMoveToPoint;
            }
        }

解决方案 »

  1.   

    发个链接 看对你有用吗  代码很简单 复制上去就可以用了http://blog.csdn.net/wxm3630478/archive/2009/06/29/4307647.aspx
      

  2.   


    using System.Runtime.InteropServices;[DllImport("user32.dll")]
            public static extern bool ReleaseCapture();
            [DllImport("user32.dll")]
            public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
            public const int WM_SYSCOMMAND = 0x0112;
            public const int SC_MOVE = 0xF010;
            public const int HTCAPTION = 0x0002;public void ShapedForm_MouseDown(object sender, MouseEventArgs e) 
            { 
                ReleaseCapture();
                SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
            }
      

  3.   


    试了下 楼主的代码  MouseMove  的时候  设置bFormDragging = false; 根本就拖不动 要改为true;也没出现楼主说的拖尾 很严重的现象.... 是不是楼主 自己的那个窗体 设计的太复杂了.....放的控件比较多.... 或者机器的显卡问题