Form2 frm2 = new Form2();
private void MoveProc()
{
frm2.StartPosition = FormStartPosition.CenterParent;
frm2.Left = this.Left + panel1.Left;
frm2.Top = this.Top + panel1.Top;
}
public Form1()
{
InitializeComponent();
MoveProc();
this.AddOwnedForm(frm2);
frm2.Show();
}
private void Form1_Move(object sender, EventArgs e)
{
MoveProc();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.StartPosition = FormStartPosition.CenterParent;
frm2.ShowDialog();
}