Guest User

Guest User

  • Tech Writer
  • 529
  • 41k

Form Position Center to Panel

Oct 22 2021 11:07 PM

DashBoard Panel 

private Form activeFrom = null;
private void OpenChildForm(Form childForm)
{
    if (activeFrom != null)
        activeFrom.Close();
    activeFrom = childForm;
    childForm.TopLevel = false;
    childForm.FormBorderStyle = FormBorderStyle.None;
    childForm.Dock = DockStyle.None;
    PanelChildForm.Controls.Add(childForm);
    PanelChildForm.Tag = childForm;
    childForm.BringToFront();
    childForm.Show();
}

Form Open Code

private void btnConfig_Click(object sender, EventArgs e)
{
    OpenChildForm(new ConfigForm());
}

 


Answers (6)