Prendendo spunto da un articolo trovato in rete, ecco come ottenere l’effetto calamita che utilizza Skype (provate ad avvicinare la finestra di skype ad un bordo, quando sarete nei pressi questa si ‘aggancia’):

private void Form1_LocationChanged(object sender, EventArgs e)
{
    int minMargin = 25;

    if (this.Left < minMargin)
        this.Left = 0;
    else if (this.Right > (Screen.PrimaryScreen.Bounds.Width - minMargin))
        this.Left = Screen.PrimaryScreen.Bounds.Width - this.Width;

    if (this.Top < minMargin)
        this.Top = 0;
    else if (this.Bottom > (Screen.PrimaryScreen.WorkingArea.Height - minMargin))
        this.Top = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
}

 

Ci sarebbe da adattarla al doppio monitor, al fatto che la taskbar può essere spostata ecc.., ma sono in ferie… se mi servirà la farò + avanti :)