Results 1 to 4 of 4

Thread: PictureBox Add Action

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    5

    PictureBox Add Action

    I have a picture box appear, and I need to make it so if they click a part on the picture box (using x,y position of the box) it does something. Thanks in advance.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: PictureBox Add Action

    Use the MouseDown event of the picturebox, and then look at the e.location property to determine the x/y coordinate where the mouse was clicked, and take whatever action needs to be taken.

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

    Re: PictureBox Add Action

    Not that kleinma is wrong, but you might want to consider using MouseClick rather than MouseDown. MouseDown is raised when and where the mouse button is depressed, whereas MouseClick is raised when and where the mouse button is released, and then only if the mouse button was depressed over the PictureBox too. Neither is right or wrong. It just depends which is more appropriate for your app.
    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

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2009
    Posts
    5

    Re: PictureBox Add Action

    Thanks. I tried both ways and it worked.

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