Jump to content


GDI: Screenshot? Graphics to Image?

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Kingherc

Kingherc

    Regular

  • Members
  • PipPip
  • 50 posts
  • Devices:HTC Diamond2
  • Twitter:@kherc
I just want to take the color of a specific color of the form. (smartphone 2003, vsnet 2003).

I figured I could use the method bitmap.GetPixel. But how do I create a bitmap with the screenshot of the screen/form?

I also thinked i could use Form.CreateGraphics to create a graphics with the screenshot. But how do I create a bitmap out of it in .net cf?

Generally, I need the color of a pixel. Thx 4 any responses!


#2
SpaceRain

SpaceRain

    Newbie

  • Members
  • Pip
  • 47 posts
If your window is called hwnd and the pixel you want is located at 24,38:

HDC hdc = GetDC(hwnd);
COLORREF MyColor = GetPixel(hdc, 24, 38);
ReleaseDC(hwnd, hdc);

MyColor now contains the color of the pixel. Can I ask why you need the color of a certain pixel?


#3
Kingherc

Kingherc

    Regular

  • Members
  • PipPip
  • 50 posts
  • Devices:HTC Diamond2
  • Twitter:@kherc
Thx for the answer. The reason why is that I was trying to make a ColorPicker form (that's complete now). But I used Bitmap.GetPixel to do that (from an image with a color pallette).

I'm developping a free Pocket Image Editor, that's why. Any help is welcome.

Could you plz, rewrite the code you told in visual basic.net cause I can't really use C...





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users