Results 1 to 6 of 6

Thread: [RESOLVED] Object Location

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    Resolved [RESOLVED] Object Location

    If i wanted to use cursor coordinates to set the location for an object lets say a picturebox, so that wherever the cursor went, the object went, how would i go about doing that, since location (x,y) is a value and therefore cannot be the target of an assignment.

    I know how to do cursor coordinates already.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Object Location

    What if you took the coordinates in the mouseMove event and assigned the x,y to the Top and Left properties of the control?
    My usual boring signature: Nothing

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    Re: Object Location

    thx that works

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: [RESOLVED] Object Location

    Oops, VB6 leaking through, I guess Top and Left have been replaced by Location.
    My usual boring signature: Nothing

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2006
    Posts
    10

    Re: [RESOLVED] Object Location

    nope its still there they just dont show it

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

    Re: [RESOLVED] Object Location

    If you want to get or set just the Top or Left property then you use the Top or Left property because the X and Y properties of the Location cannot be set through the Location property. If you want to set both the Top and Left properties then you create a Point object and set the Location property as this forces it to happen in one operation rather than two, which can be visible to the user.

    If you want to know what that message about not being the target of an assignment means then just ask.
    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

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