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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

child form resize in MDI form 1

Status
Not open for further replies.

clientuser

Programmer
Apr 18, 2001
296
US
Why do child forms resize to something totally different inside an MDI form if I have the forms property BorderStyle set to 2-sizable

But when I set it to 1-fixed, the child form doesnt resize when opened in MDI form.......

I know I can go through and program the forms height/width on open, but doing that in the MDI form makes the child form open and then for a split second resize itself and gives a flicker on the screen....... I dont like that at all..

I just wanted the users to have the ability to minimize a form if needed in the MDI form..........
 
Why ? I dont know, probable answer "by design"

To stop the flicker set the height and width in the child forms load event. You can also place the form where you like.

Me.Height = 5000
Me.Width = 5000
Me.Top = 2000
Me.Left = 2000
 
Yeah I have tried to set the height/width before and you can still see the form when it opens resize for a quick second...

Any other suggestions?
 
I use this technique all the time, I dont understand why you get the flicker. Normally the form_load event is completed before the form is visible, unless you execute me.show or me.visible = true in the form load event.

If this was before the size change you get the flicker, I just tried it.

 
have you tried it in a MDI form though? I dont show the form or make it visible before resizing........
 
is there anything else going on in your code?

ive not seen (and cant replicate) a flickering form when resizing in the form load event (and yes ive tried with an MDI form and multiple child windows)

could u provide a sample of code u are using?!?

good luck!

If somethings hard to do, its not worth doing - Homer Simpson
------------------------------------------------------------------------
To get the best response to a question, please check out FAQ222-2244 first
A General Guide To Excel in VB FAQ222-3383
 
Im not sure what was going on because I had the code for the width/height in the forms load event..

I just restarted vb and its working now.......

 
As an aside to this, i thought that any call to a form prior to it being loaded would load and show that form, so, a frmForm.Height=800 would not only set the forms height, but also load and show it.
 
If its an MDI child form it will be shown but only on exit from the form load event. Non mdichild forms will not be shown only loaded.
 
To expand my previous post - There is a property MDIFrame.AutoShowChildren, if this is set to FALSE executing say MDIChild1.Height=800 would cause the MDI child form to be loaded but not shown.





 
here is what I do:
in the mdi form:
Private Sub MDIForm_Resize()
'centers the child form
Call Module1.CenterChild(ChildForm)
End Sub

in the module:
Public ChildForm As Form

Sub CenterChild(child As Form)
Dim xTop As Integer
Dim xLeft As Integer
If child.WindowState = 0 Then
xTop = ((frm001.Height - child.Height) \ 2)
xLeft = ((frm001.Width - child.Width) \ 2)
child.Move xLeft, xTop
End If
End Sub

in the child form called frm003:
Private Sub Form_Load()

Me.MousePointer = 1 'arrow
frm001.StatusBar1.Panels(1) = Me.Name & " - " & _
Me.Caption

Set ChildForm = frm003
Call Module1.CenterChild(ChildForm)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top