-
MDI ClientSize
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
the bottom.
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()
With frm
..MdiParent = Me
..Show()
End With
End Sub
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
With frm
l = (mdi.ClientSize.Width - .Width) \ 2
t = (mdi.ClientSize.Height - .Height) \ 2
..SetBounds(l, t, .Width, .Height)
End With
End Sub
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?
Cheers,
Larry Rebich
More tips link to:
http://www.buygold.net/tips
Please:
No personal e-mail questions :-)
-
Re: MDI ClientSize
Larry,
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.
Pat
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
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
|
Bookmarks