This is not a fault-tolerant solution, but it is pure .NET, and it is dead simple. Add a timer to your form, set its relatively short delay (100-150 ms seemed good to me). Add the following code for the Form.LocationChanged and Timer.Tick events:
private void Form_LocationChanged(object sender, EventArgs e) { if (this.Text != "Moving") { this.Text = "Moving"; } tmrStoppedMoving.Start(); } private void Timer_Tick(object sender, EventArgs e) { tmrStoppedMoving.Start(); this.Text = "Stopped"; }
If you need more accurate processing (knowing that when the mouse button is released in the title bar, etc.), you will probably have to dive into monitoring Windows messages.
source share