PDA

Click to See Complete Forum and Search --> : making a form appear in a specific location


ianpaisley
Jan 5th, 2000, 02:32 AM
I have a form with a command button which makes another form pop up:

Private Sub Command1_Click()
Form2.Show
End Sub

Form1 is four times the size of form2. How can I have it so that form2 appears exactly in the bottom right hand corner of form1 - it takes up exactly a quarter of its space?

Thanks for any help!

Jan 5th, 2000, 03:07 AM
Private Sub Command1_Click()
Form2.Move Form1.Width / 2 + Form1.Left, Form1.Height / 2 + Form1.Top
'Bottom Right hand corner
Form2.Move Form1.Left, Form1.Top
'Top Left Hand Corner
Form2.Move Form1.Width / 2 + Form1.Left, Form1.Top
'Top right hand corner
Form2.Move Form1.Left, Form1.Height / 2 + Form1.Top
'Bottom Left hand Corner
Form2.Width = Form1.Width / 2
Form2.Height = Form1.Height / 2
Form2.Show
End Sub

------------------
Boothman
There is a war out there and it is about who controls the information, it's all about the information.

[This message has been edited by Boothman_7 (edited 01-05-2000).]

[This message has been edited by Boothman_7 (edited 01-05-2000).]

Serge
Jan 5th, 2000, 03:21 AM
You can use the above code to position the form. But bare in mind that if your form is not loaded yet, then you would have to load it first, ie:
Private Sub Command1_Click()
Load Form2
Form2.Move Form1.Width / 2 + Form1.Left, Form1.Height / 2 + Form1.Top
'Bottom Right hand corner
Form2.Move Form1.Left, Form1.Top
'Top Left Hand Corner
Form2.Move Form1.Width / 2 + Form1.Left, Form1.Top
'Top right hand corner
Form2.Move Form1.Left, Form1.Height / 2 + Form1.Top
'Bottom Left hand Corner
Form2.Width = Form1.Width / 2
Form2.Height = Form1.Height / 2
Form2.Show
End Sub



------------------

Serge

Software Developer
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)