Pages: 1

public void openBMP(String filename)
{
//Declare the OpenFileDialog as a new OpenFileDialog.
OpenFileDialog openFileDialog = new OpenFileDialog();
//Declare the PictureBox as a new PictureBox
PictureBox picBox = new PictureBox();
//Set the openFileDialog's Filter.
openFileDialog.Filter = "Bitmap Image|*.bmp|All Files|*.*";
//Set the openFileDialog's FileName to nothing.
openFileDialog.FileName = "";
//Show the openFileDialog
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
{
//To do code if the Open button was pressed
//Use something like:
filename = openFileDialog.FileName;
picBox.Image = Image.FromFile(filename);
}
else
{
return;
}
}-Offline- |
Pages: 1