How to display Image without using PictureBox?

  • Thread starter Thread starter Gravity
  • Start date Start date
G

Gravity

Hi,

As the title indicated, does anyone has any easy solution?

I found the I have trouble attaching images to the PictureBox in a separate
thread. Basically it just hang there and not even catch it. I am really
stuck at there. On the other hand, direct calling the function without
thread is fine.

Hope someone can give some guide line to this beginner.

Thanks for reading.
 
You cannot affect UI elements from a worker thread. Use Control.Invoke to
marshal calls back to the UI thread and affect the UI from there.

And for the archive, if you want to not use the PictureBox, use another
control like a Panel, override its OnPaint and manually paint the picture
there.

-Chris
 
Hi,

You can also consider P/Invoking the Game API, especially if you are
interested in high performance. This API is low level, it enables your
application to write bitmap directly into the display memory. It will work to
display image from the worker thread with that. As it is more complicated
than the PictureBox, I suggest you should only take a look at it if you are
interested in high performance display.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/APISP/html/sp_gx_bvrh.asp

Lionel
 
Thanks for the link. It do help. : )

Lionel Reyero said:
Hi,

You can also consider P/Invoking the Game API, especially if you are
interested in high performance. This API is low level, it enables your
application to write bitmap directly into the display memory. It will work
to
display image from the worker thread with that. As it is more complicated
than the PictureBox, I suggest you should only take a look at it if you
are
interested in high performance display.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/APISP/html/sp_gx_bvrh.asp

Lionel
 
Back
Top