Results 1 to 2 of 2

Thread: Get location of scrolling window?

  1. #1

    Thread Starter
    Lively Member VisualBrian's Avatar
    Join Date
    Nov 2019
    Location
    North America
    Posts
    72

    Question Get location of scrolling window?

    I have a large scrolling child form which is DockStyle.Fill inside an MdiParent form. The child form displays labels which you can drag around and they snap to grid when released from the mouse down event. This allows me to determine if one marker is placed upon another in the grid and not allow it.

    Name:  mapper.jpg
Views: 238
Size:  17.9 KB

    All is fine until you scroll the child form. When the child form is scrolled the grid changes because the forms "left" and "top" always returns "0" no matter how far I scroll the window.
    What is the proper method to call the actual left and top edge of the scrolled window in relation to the Parent?
    Should I be using the horizontal and vertical scroll values to adjust this or is there another way?
    I may not know anything, but I know it well!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Get location of scrolling window?

    The AutoScrollPosition property will give you the X and Y coordinates of the actual top-left of the form relative to the top-left of the viewport, e.g. if you scroll down 20 and right 50 then the property value will be {-50, -20}.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Tags for this Thread

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