Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Child forms moving down screen on loading 2

Status
Not open for further replies.

comboy

Instructor
May 23, 2003
226
Hi all,

I have a mdi form which currently has two child forms that are loaded from the menu of the mdi.
The problem is that when I open the mdi and load either of the child forms for the first time it is positioned correctly at the top of the screen under the toolbar of the mdi.
However when I unload then reload the form (either one) the form opens a couple of cm from the top. Each time I umload and reload the form(s) they move down the screen until they eventually appear at the correct position and the process starts again. There is no code etc in the forms resize event.

I've tried changing the forms from sizeable to dialod etc, and making their startup position to full screen which makes the form flicker before they appear on full screen.

Has anyone any idea how I can make the forms always appear in the correct position and if on full screen to stop flickering from standard size to full screen.

I'm training today but will check my mail when I can, thanks in advance for any ideas etc.


Graham
 
Have you tried setting the .Top property of the child forms to 0?

Just as an example:
Code:
Private Sub Form_Load()
Me.Top = 0
Me.Left = 0
End Sub
I've also included the .Left property to put it in the top left of the MDI form.

Hope this helps

HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.
 
This is the default (and expected) Windows behaviour. If you want to override it you want to add something like this to your MDI child form:

Private Sub Form_Load()
Me.Move 0, 0 'or wherever you want it to appear
End Sub
 
Thanks for that lads I'll give it a try tonight and let you know if it works.


Cheers,


Graham.
 
Lads cheers for that it worked a treat.

Graham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top