the code is here,designer window has a button and a picture box!
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Open Image";
dlg.Filter = "bmp files (*.bmp)|*.bmp";
if (dlg.ShowDialog() == DialogResult.OK)
{
PictureBox PictureBox1 = new PictureBox();
PictureBox1.Image = Image.FromFile(dlg.FileName);
/* PictureBox1.Image = new Bitmap(dlg.FileName);
// Add the new control to its parent's controls collection
this.Controls.Add(PictureBox1);
//dlg.Dispose();*/
}
}
there is no error the window opens,when i press the button it opens directory ,then selected the image ,but it is not able to load the image in the window. the image im loading is 49.6 MB ,does that create any problem.
You’ve commented out the part where you added the picturebox to your window, id also suggest setting some elementary width/height of the picturebox so you can be sure it shows on screen.
Does it work with a much smaller test image?