I have a main form that has IsMdiContainer = true.
I have a second form (FamilyForm) that is to be the MDI child.

Using the code below, when the line TempForm.MdiParent = Me is executed, the FamilyForm window size, font, and all controls are larger than shown in Visual Studio, possibly 10% larger.

Dim TempForm As New FamilyForm(DataAccess, lvSearch.SelectedItems.Item(0).Text, lvSearch.SelectedItems.Item(0).SubItems(3).Text)
        TempForm.MdiParent = Me
        TempForm.Name = lvSearch.SelectedItems.Item(0).Text
        TempForm.Show()

However, if i remove the line TempForm.MdiParent = Me (no other changes were made), then FamilyForm exactly matches what I see in Visual Studio.

Can anyone tell me what is causing the FamilyForm size to increase when the parent is assigned?

Recommended Answers

All 3 Replies

>Can anyone tell me what is causing the FamilyForm size to increase when the parent is assigned?

Please check the Font property of MDIParent form. Size of child form can't be affected.

It's not just the font. EVERYTHING on the FamilyForm increases in size including the controls (labels, textboxes, etc.). It is like the entire FamilyForm increases by 10%.

My apologies to adatapost. His/her answer sounded like he/she misunderstood my issue but the answer given was correct.

Here is the reason this happened. Because the child window did not have a font size assigned to the form, it was using the default font in Visual Studio. When it was added to the MDI container, it inherited the container's font which was larger than the child and increased the entire window (labels, textboxes, etc.) accordingly.

Here is the funny part. I originally said it was like it increased the child window by 10%. The child window was font 8.25 and the container was 9.0 which is a 9.09% increase.

Thanks adatpost for your answer and again, my apologies for jumping to the conclusion that you misunderstood my original post.

commented: No problem, glad I could help. +9
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.