How to use codes to open an image file and show on a picture box?

  • Thread starter Thread starter chowchho
  • Start date Start date
C

chowchho

Hi all,

I use a open file dialog to select an image file, then i use IO.FileStream
to read the file into an array of bytes, and i found that the compact
framework does not support System.Drawing.Image.FromStream.

Please advice how to solve this or please suggest if you have other better
method. Thank.

Regards,
Chow
 
Load the image into a Bitmap and then assign that to the PictureBox.
Something like this...

using (OpenFileDialog d = new OpenFileDialog())
{
if (d.ShowDialog() == DialogResult.OK)
{
pictureBox1.Image = new Bitmap(d.FileName);
}
}
 
Back
Top