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);
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top