How to create a bitmap for pictureBox
Posted on 2004-04-26
Hi all, I have a raw file in ppm standard (uncompressed, have RGB and header information of the width and height of the file).
I want to display it in my windows form but it seems that pictureBox does not accept PPM file.
Is there a way I can say if the file selected is a ppm file, i will create a bitmap object and put it into the pictureBox?
I checked around and believe that HBITMAP is gonna be the class object i will be creating the bitmap at.. but i am not sure how to set the R, G, B in the bitmap, (I assume its a 24bits/pixel)
What i will do is i will just read in the file stream, and set the R, G, B to the HBITMAP (or any other better choice??) object, then I will set it to the pictureBox(again, is there a way to directly set the item in pictureBox to a HBITMAP (or better choice?) object?
Thanks for any input..