你新建个窗体。不用修改一行代码。双击窗体或查看代码。在Form1类中粘贴如下代码就能实现了。

[System.Runtime.InteropServices.DllImport("user32.dll")]   
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);   
protected override void OnMouseDown(MouseEventArgs e)   
{   
    base.OnMouseDown(e);   
    if (e.Button == MouseButtons.Left)//按下的是鼠标左键   
    {   
        Capture = false;//释放鼠标,使能够手动操作   
        SendMessage(this.Handle, 0x00A1, 2, 0);//拖动窗体   
    }   
} 

相关文章: