
MDI-Child form and positon on MDI-form
Quote:
>Q: I want my MDI-ChildForms always to show centered on my MDI-form. How
>is it done ?
>Thanks.
>--
>_________________________________________________________________________
>Dyno Industrier ASA, Corporate IS/IT ph:+47 22317719 fax:+47 22317060
Hi
INSERT THIS CODE INTO A MODULE
'Replace User with User32 for VB4.0 32.
Declare Function GetSystemMetrics Lib "User" (ByVal nIndex As _
Integer) As Integer
Global Const SM_CYCAPTION = 4
Global Const SM_CXFRAME = 32
Global Const SM_CYFRAME = 33
INSERT THIS CODE INTO YOUR FORM LOAD EVENT
------------------------------------------------------------------------------------------
Private Sub Form_Load()
Dim mdiCaption As Integer
Dim mdiBorder As Integer
mdiCaption = ( GetSystemMetrics( SM_CYCAPTION ) *
Screen.TwipsPerPixelY ) + ( ( GetSystemMetrics( SM_CYFRAME ) *
Screen.TwipsPerPixelY ) * 3 )
mdiBorder = ( GetSystemMetrics( SM_CXFRAME ) * Screen.TwipsPerPixelX )
* 3
Top = ( MDIForm1.Height - mdiCaption - Height ) \ 2
Left = ( MDIForm1.Width - mdiBorder - Width ) \ 2
End Sub
Check out the Win31wh.hlp for details on GetSystemMetrics
Alan Davis, Southampton, England