Home > OS >  Windows Forms - ChildForm in panel is zoomed in
Windows Forms - ChildForm in panel is zoomed in

Time:12-11

So I have this code to show the childform within the panel:

private Form activeForm = null;
private void openChildForm(Form childForm)
{
    if (activeForm != null)
    {
        activeForm.Close();
    }
    activeForm = childForm;
    childForm.TopLevel = false;
    childForm.FormBorderStyle = FormBorderStyle.None;
    childForm.Dock = DockStyle.Fill;
    panelChildForm.Controls.Add(childForm);
    panelChildForm.Tag = childForm;
    childForm.BringToFront();
    childForm.Show();
    labelVersion.BringToFront();
}

The size of the panel and form are exactly the same (the form is a bit larger due to the border, but the borderless size is exactly as the panel). But for some reason, it seems like the form zoomes in when I open it and I can't figure it out.

CodePudding user response:

Well the strange thing is: I got it to work now. I went ahead and changed the font of the form to 10 and then back to 8 and now it fits perfectly. I don't really understand what happend there but I'm glad I got it to work now.

  • Related