How can I center Child on a parent window?
Thanks
Printable View
How can I center Child on a parent window?
Thanks
To center a child form into a MDIparent form use
Code:Form1.Left = (MDI1.ScaleWidth - Form1.ScaleWidth) / 2
Form1.Top = (MDI1.ScaleHeight - Form1.ScaleHeight) / 2
Thanks very much Vlatko!
This works, too:
And I don't believe that you use the ScaleWidth (or ScaleHeight) of Form1 to center it. You use ScaleWidth & ScaleHeight of MDIForm1 (parent form), and Width & Height of Form1 (child form).Code:With Form1
.Move (MDIForm1.ScaleWidth - .Width) / 2, _
(MDIForm1.ScaleHeight - .Height) / 2
End With
Hope that helps!