using System.Runtime.InteropServices; namespace HappyFarm { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("user32.dll")] private static extern bool ReleaseCapture(); [DllImport("user32.dll")] private static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParm, int lParm); public const int WM_SYSCOMMAND = 274; //0x0112; public const int SC_MOVE = 61456;//0xf010; public const int HTCAPTION = 2; private void Form1_MouseDown(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); }