In three ways I tried to display an image within a Windows Forms Picturebox using Visual C++ 2010 Express. The files path I fetch with an openFileDialog
. Here are the three attempts:
1.
pictureBox1->ImageLocation = openFileDialog1->FileName;
2.
Bitmap^ image1;
image1 = gcnew Bitmap(openFileDialog1->FileName, true);
pictureBox1->Image = image1;
3.
pictureBox1->Image = static_cast<Bitmap ^>(Image::FromFile(openFileDialog1->FileName));
Before the image is displayed finally an error- or info-message pops up. The message window has no name an shows BM6
(opening a Bimap-Image), nothing
(opening a JPEG-Image) or ?PNG[]
(opening a PNG-Image).
Question: How I can avoid those messages when displaying an image within a picturebox?