简体   繁体   中英

How to get a bitmap drawn in a handled control

I am working with a fingerprint sensor under C# .NET. It shows the captured fingerprint by handling a control, like this:

this.Sensor.SetDisplay((int)this.PictureBoxFingerprint.Handle);

I need to get the image the sensor displays and save it to an Image control. However, PictureBoxFingerprint.Image does not contain any data (because of the handling strategy, I suppose). I have tried to use the DrawToBitmap method from the containing form, setting all the coordinates where the fingerprint image is placed, without any luck also. Is there another way of accomplishing this? Thanks!

Sounds like a sub-standard library if you can't get the image.

Assuming PictureBoxFingerprint is a standard window control you might get some mileage from basic interop; get the control dc and bitblit (copy) the content to an in memory bitmap. This article [1] should point you in the right direction; start with the int CaptureAnImage(HWND hWnd) method.

There is of course the problem that the quality of the image you get may not be all that good depending on what has happened to it on the way to the screen. Good Luck

[1] http://msdn.microsoft.com/en-gb/library/windows/desktop/dd183402(v=vs.85).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM