Harini
July 18th, 2001, 01:37 PM
I have an MDI application in which there are one Mainform(call MainScreen) and two child forms (Call Form1 and Form2). The Window state of the Main form is set as Maximized in the design form. I have a menu (call file) in the MainForm by clicking on which two child forms are dispalyed.
private Sub file_Click()
Form1.Show
Form2.Show
End Sub
I have written the follwing code in the Resize event of the child forms.
private Sub Form_Resize()
Dim iWidth as Integer, iHeight as Integer
Dim iTop as Integer, iLeft as Integer
Dim bMax as Boolean
bMax = false
If me.WindowState = vbMaximized And Not bMax then
me.Hide
bMax = true
me.WindowState = vbNormal
me.Width = MainScreen.Width / 1.4
me.Height = 2.4 / 3 * MainScreen.Height
me.Top = MainScreen.Top + MainScreen.Height / 50
me.Left = MainScreen.Left + MainScreen.Width / 3.8
me.Show
ElseIf bMax = true And me.WindowState = vbMaximized then
me.Hide
me.WindowState = vbNormal
me.Width = iWidth
me.Height = iHeight
me.Top = iTop
me.Left = iLeft
bMax = false
me.Show
ElseIf Not bMax then
iWidth = me.Width
iHeight = me.Height
iTop = me.Top
iLeft = me.Left
End If
End Sub
Now when I run the application and click on the file menu then both the forms Form1 and Form2 are shown. Now If I double click on the titlebar of the one Form say Form1 then the Form_Resize() event of the secondform, ie Form2, is getting fired.
In the above Form_Resize(), what I am trying to do is to bring the Form size to required size when double clicked on the form. I am hiding the form to avoid the flickering effect.
Can anybody please tell me why is it happening and the solution to avoid this.
Thanks
Harini
private Sub file_Click()
Form1.Show
Form2.Show
End Sub
I have written the follwing code in the Resize event of the child forms.
private Sub Form_Resize()
Dim iWidth as Integer, iHeight as Integer
Dim iTop as Integer, iLeft as Integer
Dim bMax as Boolean
bMax = false
If me.WindowState = vbMaximized And Not bMax then
me.Hide
bMax = true
me.WindowState = vbNormal
me.Width = MainScreen.Width / 1.4
me.Height = 2.4 / 3 * MainScreen.Height
me.Top = MainScreen.Top + MainScreen.Height / 50
me.Left = MainScreen.Left + MainScreen.Width / 3.8
me.Show
ElseIf bMax = true And me.WindowState = vbMaximized then
me.Hide
me.WindowState = vbNormal
me.Width = iWidth
me.Height = iHeight
me.Top = iTop
me.Left = iLeft
bMax = false
me.Show
ElseIf Not bMax then
iWidth = me.Width
iHeight = me.Height
iTop = me.Top
iLeft = me.Left
End If
End Sub
Now when I run the application and click on the file menu then both the forms Form1 and Form2 are shown. Now If I double click on the titlebar of the one Form say Form1 then the Form_Resize() event of the secondform, ie Form2, is getting fired.
In the above Form_Resize(), what I am trying to do is to bring the Form size to required size when double clicked on the form. I am hiding the form to avoid the flickering effect.
Can anybody please tell me why is it happening and the solution to avoid this.
Thanks
Harini