Попробуйте TableLayoutPanel, но я не помню, правильно ли, забыл. Вот для C#
private void pictureBox2_MouseMove(object sender, MouseEventArgs e)
{
pictureBox2.Location =
new Point((Cursor.Position.X - this.Location.X - 55), (Cursor.Position.Y - this.Location.Y - 55));
}
private void pictureBox2_MouseMove(object sender, MouseEventArgs e)
{
if (status == true)
pictureBox2.Location =
new Point((Cursor.Position.X - this.Location.X - 55), (Cursor.Position.Y - this.Location.Y - 55));
}
private void pictureBox2_LocationChanged(object sender, System.EventArgs e)
{
if (pictureBox2.Location.Y <= pictureBox1.Location.Y || pictureBox2.Location.X <= pictureBox1.Location.X)
status = false;
if ((pictureBox2.Location.Y >= (pictureBox1.Location.Y + pictureBox1.Height - 50) || pictureBox2.Location.X >= (pictureBox1.Location.X + pictureBox1.Width - 100)))
status = false;
}
private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
if ((Cursor.Position.X - this.Location.X) >= (pictureBox1.Location.X + 50))
status = true;
if ((Cursor.Position.Y - this.Location.Y) >= (pictureBox1.Location.Y + 25))
status = true;
}
Только это для pictureBox, поменяйте на Button1. С++ и C# похожи. Подредактируйте код и должно получиться!