View image in picture box from file

G

Guest

private void Apri_Click(object sender, System.EventArgs e)
{
OpenFileDialog fileChooser=new OpenFileDialog();

//fileChooser.Filter="tiff images (*.tiff)|*.tiff";

DialogResult result = fileChooser.ShowDialog();

Image immagine = New Image(fileChooser.FileName);

PictureBox.Image = immagine;
}

where's the error?
 
L

Ludovic SOEUR

You have to use FromFile method....

Image immagine = Image.FromFile(fileChooser.FileName);
pictureBox1.Image = immagine;

Hope it helps,

Ludovic Soeur.
 
G

Guest

HI Fabio,

Replace the following statement in your code

Image immagine = New Image(fileChooser.FileName);

with this.

System.Drawing.Bitmap immagine = new Bitmap(fileChooser.FileName);

You can assign only a bitmap object to the image property of the PictureBox

happy programming!!
pradeep_TP
 
G

Guest

if i write this

Image immagine = Image.FromFile(fileChooser.FileName);
pictureBox1.Image = immagine;


tell me

'System.Drawing.Image' does not contain a definition for 'FromFile'
 
G

Guest

This one give me errors deployment :(

pradeep_TP said:
HI Fabio,

Replace the following statement in your code

Image immagine = New Image(fileChooser.FileName);

with this.

System.Drawing.Bitmap immagine = new Bitmap(fileChooser.FileName);

You can assign only a bitmap object to the image property of the PictureBox

happy programming!!
pradeep_TP
 
G

Guest

The code that you give me are good but they don't work for my application
cause is a program for a pocket pc. Why there's a lot of problem to develop
an application for a pocket pc? How can i do to open an image for a ppc?
 

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

Top