Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Graphics question

Graphics question

Scheduled Pinned Locked Moved Visual Basic
csharpgraphicstutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sa_runner
    wrote on last edited by
    #1

    I have a circle, or any polygon, drawn on a form via VB.NET (2k5 in this case). I would like to know if my cursor is inside of the circle/polygon. Is there an easy way to know this. I've been tinkering with the use of the x,y location of the mouse pointer, but don't know how to convert this into the location of the circle. Thanks in advance for any advice.

    C 1 Reply Last reply
    0
    • S sa_runner

      I have a circle, or any polygon, drawn on a form via VB.NET (2k5 in this case). I would like to know if my cursor is inside of the circle/polygon. Is there an easy way to know this. I've been tinkering with the use of the x,y location of the mouse pointer, but don't know how to convert this into the location of the circle. Thanks in advance for any advice.

      C Offline
      C Offline
      Chinners
      wrote on last edited by
      #2

      I am not 100% sure of how to do this, but you could try looking at the Region.Intersect function. For example, if each of your graphics objects have an associated region, you could test to see if a point (mouse cursor) intersects with your region. If the result region is empty then there is no hit.

      S 1 Reply Last reply
      0
      • C Chinners

        I am not 100% sure of how to do this, but you could try looking at the Region.Intersect function. For example, if each of your graphics objects have an associated region, you could test to see if a point (mouse cursor) intersects with your region. If the result region is empty then there is no hit.

        S Offline
        S Offline
        sa_runner
        wrote on last edited by
        #3

        Thanks! That helped alot. I found a pretty good link on this, because of your answer (doing more research). It's http://www.informit.com/articles/printerfriendly.aspx?p=29477[^]. I got my code working the way I want now. Thanks again.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups