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. C#
  4. Mouse move (hover) over an Image with Graphics drawings

Mouse move (hover) over an Image with Graphics drawings

Scheduled Pinned Locked Moved C#
graphicsquestion
2 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.
  • E Offline
    E Offline
    eyalbi007
    wrote on last edited by
    #1

    Hi All, I have an image on which I'm drawing elements ("masks") using a Graphics object (g.DrawCurve, g.FillRectangle, g.DrawPolygon etc.). Now, when hovering with the mouse over the image, I need to know whether I'm hovering over a mask (a part that was drawn using the Graphics object). I couldn't find a way to get a Graphic's drawing pixels... any ideas? Thanks!

    L 1 Reply Last reply
    0
    • E eyalbi007

      Hi All, I have an image on which I'm drawing elements ("masks") using a Graphics object (g.DrawCurve, g.FillRectangle, g.DrawPolygon etc.). Now, when hovering with the mouse over the image, I need to know whether I'm hovering over a mask (a part that was drawn using the Graphics object). I couldn't find a way to get a Graphic's drawing pixels... any ideas? Thanks!

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      One thing you could do is this: - have a bitmap ("bm") the same size as the object you are drawing on, then get its graphics ("gbm") and fill with a white backcolor; - mimic all your drawing on gbm too, using any color but white; - when you need to know whether a point (x,y) is mask or not, look at bm.GetPixel(x,y) and the color will tell you. :)

      Luc Pattyn [My Articles] Nil Volentibus Arduum

      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