拖动是有虚框[DllImport("user32.dll",EntryPoint="SendMessage")]
public static extern int SendMessage(int hWnd,int wMsg,int wParam,int lParam);
[DllImport("user32.dll",EntryPoint="ReleaseCapture")]
public static extern int ReleaseCapture();
public const int WM_SysCommand = 0x0112;
public const int SC_MOVE = 0xF012;private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
ReleaseCapture();
    SendMessage(this.Handle.ToInt32(),WM_SysCommand,SC_MOVE,0);
}
拖动时没虚框public static int MouseX;
public static int MouseY;
public static bool isMove;
public static int CurrX;
public static int CurrY;private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
isMove = true;
MouseX = e.X;
MouseY = e.Y;
}
}private void Form1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (isMove == true)
{
CurrX = Form1.ActiveForm.Left - MouseX + e.X;
CurrY = Form1.ActiveForm.Top - MouseY + e.Y;
Form1.ActiveForm.Left = CurrX;
Form1.ActiveForm.Top = CurrY;
}
}private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Left){isMove = false;}
}