using System.Runtime.InteropServices;
......public const int WM_NCLBUTTONDOWN = 0xA1; 
public const int HTCAPTION = 0x2; [DllImportAttribute ("user32.dll")] 
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); 
 
[DllImportAttribute ("user32.dll")] 
public static extern bool ReleaseCapture(); private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
   ReleaseCapture(); 
   SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0); 
}

解决方案 »

  1.   

    mousemove里的编程不是已经什么都有了 你说的能不能详细点啊
      

  2.   

    如果你了解VC下如何做这个就没问题了,因为本质是一样的就是“骗”操作系统,使其认为是在标题栏上左键按下
    SendMessage(hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0)
      

  3.   

    看一下这段代码就明白了:
    private Point mypoint; private void Form1_Load(object sender, System.EventArgs e)
    {
    this.MouseDown+=new System.Windows.Forms.MouseEventHandler(this.Form_MouseDown  );
    this.MouseMove +=new System.Windows.Forms.MouseEventHandler(this.Form_MouseMove  );
    } private void Form_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) 

    if (e.Button==MouseButtons.Left)
    this.mypoint=new Point(-e.X,-e.Y)  ;  

    private void Form_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e) 

    if (e.Button==MouseButtons.Left)
    {
    this.SetDesktopLocation(this.Left+e.X +this.mypoint .X ,this.Top +e.Y +this.mypoint .Y );   
    }