日期:2014-05-17 浏览次数:20679 次
OpenFileDialog dag = new OpenFileDialog();
fname = dag.FileName;
dag.Filter = "JPEG(*.jpg)|*.jpg|BMP(*.bmp)|*.bmp";
dag.FilterIndex = 1;
dag.CheckFileExists = true;
dag.ShowDialog();
if (File.Exists(dag.FileName))
{
FileInfo f = new FileInfo(dag.FileName);
filename = f.Name;
File.Copy(dag.FileName, Application.StartupPath + "\\" + filename);
}
pictureBox.Image=Image.FromFile(dag.FileName);//显示
if (File.Exists(dag.FileName))//保存
{
FileInfo f = new FileInfo(dag.FileName);
filename = f.Name;
File.Copy(string.Contact(DateTime.Now.Tostring("yyyy MMddHHmmss"),".", Path.GetExtension(dag.FileName)), Application.StartupPath + "\\" + filename);
&nbs