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. getting pixels

getting pixels

Scheduled Pinned Locked Moved C#
csharpgraphicsc++tutorialquestion
4 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.
  • Q Offline
    Q Offline
    quilkin
    wrote on last edited by
    #1

    Hi Anyone out there know how to do a 'GetPixel' (i.e. find what colour is at a Point) with c#? There's a method GetPixel for a BitMap, but not for an arbitrary point on the screen (or a graphics object). MFC had what I needed, but it's gone from .NET!

    M 1 Reply Last reply
    0
    • Q quilkin

      Hi Anyone out there know how to do a 'GetPixel' (i.e. find what colour is at a Point) with c#? There's a method GetPixel for a BitMap, but not for an arbitrary point on the screen (or a graphics object). MFC had what I needed, but it's gone from .NET!

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      chris fearnley wrote: (or a graphics object). You can assign a Bitmap to graphic object with Graphics.FromImage(),then if you do change in graphic object it is reflected in bitmap. So GetPixel() works there too. I can't undestand how it doesn't solve it. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope

      Q 1 Reply Last reply
      0
      • M Mazdak

        chris fearnley wrote: (or a graphics object). You can assign a Bitmap to graphic object with Graphics.FromImage(),then if you do change in graphic object it is reflected in bitmap. So GetPixel() works there too. I can't undestand how it doesn't solve it. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope

        Q Offline
        Q Offline
        quilkin
        wrote on last edited by
        #3

        I don't have an image to use Graphics.FromImage(), I just have some lines that have been mathematically drawn. Can I convert the whole area into a Bitmap,then use GetPixel()?

        M 1 Reply Last reply
        0
        • Q quilkin

          I don't have an image to use Graphics.FromImage(), I just have some lines that have been mathematically drawn. Can I convert the whole area into a Bitmap,then use GetPixel()?

          M Offline
          M Offline
          Mazdak
          wrote on last edited by
          #4

          Search this site to find lots of example. You can first create a Bitmap object and assign it to Graphics object, then draw whatever you want to it. This will works I think. Mazy "A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope

          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