I already asked a question about this, but there is already a solution only when dragging the title bar of the window. I tried to write my solution, based on that code. It seems to work, but it twitches a little. Can you recommend something? Here , if someone wants to check how it works.

private const int SnapDist = 75; private bool DoSnap(int pos, int edge) { int delta = pos - edge; return delta > 0 && delta <= SnapDist; } protected override void OnLocationChanged(EventArgs e) { bool t = false; System.Drawing.Point Location = new System.Drawing.Point(); Location.X = (int)Left; Location.Y = (int)Top; Screen scn = Screen.FromPoint(Location); if (DoSnap((int)Left, scn.WorkingArea.Left)) { Left = scn.WorkingArea.Left; t = true; } if (DoSnap((int)Top, scn.WorkingArea.Top)) { Top = scn.WorkingArea.Top; t = true; } if (DoSnap(scn.WorkingArea.Right, (int)(Left + Width))) { Left = scn.WorkingArea.Right - Width; t = true; } if (DoSnap(scn.WorkingArea.Bottom, (int)(Top + Height))) { Top = scn.WorkingArea.Bottom - Height; t = true; } if (!t) base.OnLocationChanged(e); } 

    0