|
-
January 22nd, 2008, 04:14 AM
#1
Grey area around child form
Hi all
I have a MIDIForm with two child forms. (Form1 and Form2)
Both the child forms are the same size and have identical properties set.
When Form1 loads its fills the midiForm perfectly.
When I hide form1 and show Form2, the form2 is "offset" down and to the right leaving a grey area on two sides (Top and left)
Any idea what I am doing wrong?
Many thanks
-
January 22nd, 2008, 05:29 AM
#2
Re: Grey area around child form
At a guess, I would say that you must make sure that your Form2's Left and Top properties are exactly the same as Form1's in run time, for example, put this into the Click event of the button you use to Hide Form1, and Show Form2 :
Code:
Private Sub Command1_Click()
Me.Hide 'Hide Form1
Form2.Show 'Show Form2
Form2.Left = Form1.Left 'Set Form2's Left = To Form1.Left
Form2.Top = Form1.Top 'Set Form2's Top = To Form1.Top
End Sub
-
January 22nd, 2008, 08:41 AM
#3
Re: Grey area around child form
Yes. That would work.
In fact you did nothing wrong, but there is an automatism which places the windows one under the other. A third window would again be positioned with another offset to the second window so that in case they all were visible you could see the title bars of all stacked windows.
If you want the window to appear always in the same place as the first, Hannes' solution is perfect. Also you might wish to supply absolute coordinates like Form2.Move 0, 0 which always puts the window in the top left corner.
-
January 22nd, 2008, 09:13 AM
#4
Re: Grey area around child form
One thing to add -- if the "grey area" is where the hidden form was, you might have to force the mdi parent to redraw itself. Either toss a DoEvents into your Form2 loading code or explicitly call "MDIForm.Refresh".
-
January 22nd, 2008, 01:12 PM
#5
Re: Grey area around child form
Excellent. Many thanks for your help everyone.
Have not tried it yet but it sounds like I have a few options now.
Very grateful to you
Regards
Adrian
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
|
Click Here to Expand Forum to Full Width
|