B
Bart
Hi all,
I would like to open an OpenFileDialog to find an image and store it in the
folder of my application, so I can refere to it in the future only by
"./picture/file".
My code looks like that:
//openFileDialog and set up Filter,Title and Initial Directory
openFileDialog1.Filter = "Bitmap Image(*.bmp)|*.bmp|GIF Image
(*.gif)|*.gif|JPEG Image(*.jpg)|*.jpg|All files (*.*)|*.*" ;
openFileDialog1.Title = "Choose a picture";
openFileDialog1.InitialDirectory = "C:\\";
if (openFileDialog1.ShowDialog()== DialogResult.OK)
{
pictureBox1.Image=Image.FromFile(openFileDialog1.FileName);
System.IO.FileInfo MyFile=new
System.IO.FileInfo(openFileDialog1.FileName);
MyFile.CopyTo(@".\Picture\"+MyFile.Name,true);
PicturePath=".\\Picture\\"+MyFile.Name;
}
now the problem is that if I do like that it will create a folder "Picure"
in each directory I have found the image! How could I set up the directory
of my application?
Thank you very much,
Bart
I would like to open an OpenFileDialog to find an image and store it in the
folder of my application, so I can refere to it in the future only by
"./picture/file".
My code looks like that:
//openFileDialog and set up Filter,Title and Initial Directory
openFileDialog1.Filter = "Bitmap Image(*.bmp)|*.bmp|GIF Image
(*.gif)|*.gif|JPEG Image(*.jpg)|*.jpg|All files (*.*)|*.*" ;
openFileDialog1.Title = "Choose a picture";
openFileDialog1.InitialDirectory = "C:\\";
if (openFileDialog1.ShowDialog()== DialogResult.OK)
{
pictureBox1.Image=Image.FromFile(openFileDialog1.FileName);
System.IO.FileInfo MyFile=new
System.IO.FileInfo(openFileDialog1.FileName);
MyFile.CopyTo(@".\Picture\"+MyFile.Name,true);
PicturePath=".\\Picture\\"+MyFile.Name;
}
now the problem is that if I do like that it will create a folder "Picure"
in each directory I have found the image! How could I set up the directory
of my application?
Thank you very much,
Bart