I've been struggling with this on and off for a week. The scenario:
1. Create a form and make it an MDI [IsMdiContainer=True]
2. Place two panels on the MDI form. Align one to the top and the other to
3. Create one MDI Child Form [frmChild]. Use the following in the MDI form
to load the Child:
Private Sub LoadAChildForm()
Dim frm As Form
frm = New frmChild()
..MdiParent = Me
4. Center the form in the MDI Client Area using something like:
Public Sub CenterFormInMDI(ByVal mdi As Form, ByVal frm As Form)
Dim l As Integer, t As Integer
l = (mdi.ClientSize.Width - .Width) \ 2
t = (mdi.ClientSize.Height - .Height) \ 2
..SetBounds(l, t, .Width, .Height)
5. The form will not be centered in the MDI because 'ClientSize' is not
returning the correct internal client area size.
Is there another way to get the size of the Client area? How can I center
the form in the client area of the MDI?
More tips link to:
No personal e-mail questions :-)
Re: MDI ClientSize
BTW - did you read Bill McCarthy's response for Me.DesktopBounds?
You should try it instead of the method you sent me. His approach is much
cleaner than what you suggested.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL