Results 1 to 3 of 3

Thread: making a form appear in a specific location

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Post

    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!

  2. #2
    Guest

    Post

    Code:
    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).]

  3. #3
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    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:
    Code:
    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
    [email protected]
    ICQ#: 51055819



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width