OpenFileDialog openfile = new OpenFileDialog();
openfile.Filter = "图片*.jpg;*.png;*gif|*.jpg;*.png;*gif";
if (openfile.ShowDialog() == DialogResult.OK)
{
string path = openfile.FileName;
this.picbox1.ImageLocation = path;
// string OldName = openfile.FileName;//老名称,也就是打开的位置
// string newName = Directory.GetCurrentDirectory()+"\\Image\\"+ DateTime.Now.ToString("yyyyMMddHHmmss")+ ".jpg";
// FileInfo fileinfo = new FileInfo(OldName);//从老地址
// fileinfo.CopyTo(newName);//复制到新地址
// this.picbox1.ImageLocation = newName;
label1.Text = path;
label2.Text = Path.GetFileNameWithoutExtension(openfile.FileName);
tpath = path;
//tname = Path.GetFileNameWithoutExtension(openfile.FileName);//不包括后辍
tname = Path.GetFileName(openfile.FileName);
}