Results 1 to 6 of 6

Thread: Find position of a form

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154

    Question Find position of a form

    Hey All,

    I need to find the position of a form on the screen. I don't need
    the exact position, just whether or not it is past 75% of the
    screen width.

    To be more specific, here is the situation...

    I have a little form (100 x 100 pixels). At a given interval, the
    form increases in size to 200 pixels wide. If the form is located
    to the far right of the screen, the user will not be able to see the
    whole form. I need to be able to find the form, and determine
    if it is located past 75% of the screen width. If it is, then I will
    need to move the form to the left, so when it expands to 200
    pixels, the user will see the entire form.

    I hope I explained this so everyone can understand it.

    Thanks in advance,
    Ron

  2. #2
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    check out the form's "top" and "left" properties

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154
    The reason I was wanting to work with percentages was so it
    would work with all screen resolutions.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974
    The reason I was wanting to work with percentages was so it
    would work with all screen resolutions.
    erm, that's backwards... if you are working with percentages it will be far less accurate.


    Try:

    If Me.Left + Me.Width > Screen.Width Then Me.Left = Screen.Width - Me.Width


    It should be perfect for every screen resolution, and whatever the size of the form currently is

  5. #5
    PowerPoster
    Join Date
    Aug 2001
    Location
    new jersey
    Posts
    2,904
    The reason I was wanting to work with percentages was so it would work with all screen resolutions.
    if you are unable to move from absolutes to percentages, I suggest you dust off your high school algebra book.

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    154
    Hey Guys,

    The code si_the_geek gave worked fine. Simple, and to the
    point.

    Thanks for all the input,
    Ron

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