Results 1 to 4 of 4

Thread: Windows Location, relative forms.

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    9

    Windows Location, relative forms.

    Hi,

    I'm currently developing some software, in which I developed my own Input system for Forms. Today I'm focusing on the one thing I'm baffled to understand.

    I have my normal Form1 as it were to a blank project, and inside that I called a new form to be created ( Custom message box ). It works all fine. However I'm wanting to make this new created forms location relative to the main forms X/Y coords.

    So for instance, Main form opens, click button, it creates my new form but to the right hand side of the main form and if more are created at the same time it's position would be now relative to the main form and the currently opened msgbox. Here's an image of my question


  2. #2
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Windows Location, relative forms.

    The theory is straight forward enough if all your boxes above are windows. You set the .Position of the new msgbx relative to the form, or the last created msgbx. So the form has its own Form.Left, you just add on its Form.Width and you are at the right-hand side. You can get the msgbx.Height and minus that from the Form.Height, to get the distance, add on the Form.Top and you have the correct location. It's just maths, I have given you the keywords you need, have a go.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2011
    Posts
    9

    Re: Windows Location, relative forms.

    Ah great, I wasn't aware I could derive forms .Left with the Width as I thought .Left was just a temporary holder of the value. Appreciate the support, thanks.

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Windows Location, relative forms.

    You can work with Position.X and Position.Y I believe, guess .Left is a hangover pointing to the same value anyway.

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