{% else-1 %}
Создать обработчик формы Move и записать в него этот код.
MAGNETE_PIXELS задаёт, сколько пикселей экрана должна пересечь форма, чтобы пристыковаться к краю. C+

                        
private void Form1_Move(object sender, EventArgs e)
{
const int MAGNETE_PIXELS = 15;
int x = this.Location.X;
int y = this.Location.Y;
int ww = Screen.PrimaryScreen.Bounds.Width;
int hh = Screen.PrimaryScreen.Bounds.Height;
//горизонталь
if (x <= MAGNETE_PIXELS) x = 0;
else if ((ww - this.Location.X - this.Width) <= MAGNETE_PIXELS) x = ww - this.Width;
//вертикаль
if (y <= MAGNETE_PIXELS) y = 0;
else if ((hh - this.Location.Y - this.Height) <= MAGNETE_PIXELS) y = hh - this.Height;

this.Location = new Point(x, y);
}
0 16 0
Без комментариев...