Results 1 to 2 of 2

Thread: Loading byte array into picture box.

  1. #1

    Thread Starter
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    South Africa
    I have a picture as a byte array. How can I display this picture in a Picture Box?

    Don't forget to rate the post

  2. #2
    New Member
    Join Date
    Nov 2000
    That's tricky. Use BitBlt Api function. You have the byte array (and you know the width and height of the bitmap... color depth...). Well, I use a technique, but it involves creating a bitmap. Here's some pointers, maybe will help.

    1. Create a device dependent bitmap (using CreateDIBitmap, study BITMAPINFO, BITMAPINFOHEADER structures) using the byte array.
    2. Then create a DC in memory (CreateCompatibleDC, compatible with the PictureBox' own DC) and select the previously created bitmap in it (SelectObject)
    3. Copy the bits from that DC to the picturebox with BitBlt. Powerfull function BitBlt yes...

    Don't forget to delete all objects you created, otherwise you will not be able to see many bitmaps (trust me..)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width