标签:
OpenFileDialog openFileDlg = new OpenFileDialog(); openFileDlg.Title = "选择文件"; openFileDlg.Multiselect = false; openFileDlg.InitialDirectory=Environment.GetFolderPath(Environment.SpecialFolder.Desktop);//设置默认路径为桌面 openFileDlg.Filter = "(*.jpg,*.png,*.jpeg,*.bmp,*.gif)|*.jgp;*.png;*.jpeg;*.bmp;*.gif|All files(*.*)|*.*"; //设置多文件格式 if (openFileDlg.ShowDialog() == DialogResult.OK) { String filePath = openFileDlg.FileName; this.pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; this.pictureBox1.ImageLocation = filePath;//选择照片后在PictureBox中显示 }
标签:
原文地址:http://www.cnblogs.com/AmatVictorialCuram/p/5525757.html