public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;
[DllImport("user32.dll", EntryPoint = "SendMessageA")]
private static extern int SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
[DllImport("user32.dll")]
private static extern int ReleaseCapture();
private void Form_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(btn_rensheng.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
本文转自94cool博客园博客,原文链接:http://www.cnblogs.com/94cool/articles/1524863.html,如需转载请自行联系原作者