• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

positioning MDI Child windows

In my program, the MDI Child forms take a Cascading effect, when I load and show them.

To eliminate this, I use the following code in the MDI Child Form's Activate Event.
 
   'Me.Left=(Screen.width-Me.Width)/2
    me.top=0 '

But when the form is activated, it gives a moving effect (i.e), the form is displayed initially as cascading then it moves to the correct position.

But I want to place my forms without the moving effect, in the Center of my MDI Parent.

Can anybody help me??
0
SRIVB
Asked:
SRIVB
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
Place your code in the Form_Load event instead of the Form_Activate event.
0
 
fnanoCommented:
The source code to resource this problem ...

( On child form )
....
Private sub Form_Load()

   ' Ajust the form size and center this.
   Me.Width = 6500
   Me.Height = 4500
   CenterForm Me

End Sub


( On MDI Parent form )
....
Public Sub CenterForm(ByRef FormToCenter as Form )

   FormToCenter.Move ((Me.ScaleWidth - CenterToForm.Width) / 2), ((Me.ScaleHeight - CenterToForm.Height ) / 2 )
End Sub

     
0
 
SRIVBAuthor Commented:
Thank you!!!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now