MDI-Child form and positon on MDI-form 
Author Message
 MDI-Child form and positon on MDI-form

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



Mon, 04 Jan 1999 03:00:00 GMT  
 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 ?

It's not that hard to understand, is it?

Left = (AvailableWidth - Width) / 2
Height = (AvailableHeight - Height) / 2

Now use whatever you {*filter*}y like for Available*, be it Screen.* or
mdiForm.*

--
VB Info: http://www.*-*-*.com/ ~balchen/vb/visual.htm
FAQ: http://www.*-*-*.com/ ~balchen/vb/faq.htm
Knowledge Base: http://www.*-*-*.com/ ~balchen/vb/kb.htm



Mon, 04 Jan 1999 03:00:00 GMT  
 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.

You can use the "move" method of che child form, using the scalewidth
and scaleheight property of the father form.


Mon, 04 Jan 1999 03:00:00 GMT  
 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



Tue, 05 Jan 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Q: Form activate Fires On Non Child MDI Forms But Only Once On Child Mdi Forms

2. Modifying object in MDI Parent form from MDI Child form

3. Make a reference to a MDI form with a reference of a MDI child form

4. Developing OLE MDI Child forms displayed on Control MDI Form

5. MDI child forms on top of a picture on a MDI form

6. Help with MDI Forms and MDI child forms

7. Modal non MDI forms and Modeless MDI child forms in VB 5.0

8. Allow MDI Child form to overlap Aligned Picture Box in MDI Form

9. Having MDI form with MDI Child form in DLL

10. Accessing Objects on a Mdi Parent form from a Mdi Child form

11. Allow MDI Child form to overlap Aligned Picture Box in MDI Form

12. Allow MDI Child form to overlap Aligned Picture Box in MDI Form

 

 
Powered by phpBB® Forum Software