questo è un pezzo di codice elaborato controllare se è giusto inoltre btn1 è l'oggetto padre btn 2 l'oggetto figlio(quello che deve essere spostato)codice:int dX = btn2.Location.X - btn2.Location.X; int dY = btn1.Location.Y - btn2.Location.Y; //il nostro valore d0 int d = (dX * -1) + 2 * dY; //assegna le coordinate iniziali int x = btn2.Location.X; int y = btn2.Location.Y; //btn1.Location = new Point(x, y); matrice.Add(x); matrice.Add(y); while (x < btn1.Location.X) { if (d >= 0) { d = d - 2 * dX + 2 * dY; y = y + 1; x = x + 1; } else { d = d + 2 * dY; x = x + 1; } //btn2.Location = new Point(x, y); matrice.Add(btn2.Location.X); matrice.Add(btn2.Location.Y); }