The picture box Handle is passed to the external library.
After specified event is triggered, then result picture is display on the picture box.
I tried to get the picture box content to save to picture but I found that
pictureBox.Image = null
pictureBox.BackgroundImage = null
How can I get the image displaying at picture box beside of these two?
Your external library is using the handle to draw directly into the
PictureBox
control's window. Unfortunately, this does not in fact result in any sort of permanent assignment of an image. It's strictly a one-time event; not only will it not set the properties you are interested in, it's unlikely that the drawn image will even remain on the screen if the window needs to be updated for any reason (e.g. is overlapped by another window and then exposed again).Without a lot more details about the external library, it is not possible to suggest a specific solution. Ideally, the library itself will offer some alternative mechanism for it to deliver the image you want. Then you can use that data to initialize a managed
Bitmap
object which can then be assigned to yourPictureBox
as itsImage
. I guess one hack would be to let the library draw into the window, and then useGraphics.CopyFromScreen()
to copy straight from the screen's own graphics buffer the data you want.