Jump to content

GDI: Screenshot? Graphics to Image?


Guest Kingherc

Recommended Posts

Guest Kingherc

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!

Link to comment
Share on other sites

Guest SpaceRain

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?

Link to comment
Share on other sites

Guest Kingherc

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

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.