using (OpenFileDialog ofd = new OpenFileDialog())
{
ofd.Title = "请选择要插入的图片";
ofd.Filter = "JPG图片|*.jpg|BMP图片|*.bmp|Gif图片|*.gif";
ofd.CheckFileExists = true;
ofd.CheckPathExists = true;
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
{
path = ofd.FileName;
picHeadImg.ImageLocation = path; //PictureBox
}
else
{
MessageBox.Show("你没有选择图片", "信息提示");
}
}
相关文章
- 01-07Xcode svn import项目 上传.a文件(静态库)
- 01-07<<< 将一个rar格式的文件变成一张jpg图片,按照后缀来选择打开他的模式
- 01-07NSIS FileOpen打开读写文件操作
- 01-07.h头文件、 .lib库文件、 .dll动态链接库文件之间的关系
- 01-07万恶技术系列笔记-jupyter工作路径和源文件打开方式
- 01-07SpringBoot下载Excel文件,在Wps上可以打开但是Office上的excel打不开的问题
- 01-07Excel无法打开文件xxx.xlsx,因为文件格式或文件扩展名无效。请确定文件未损坏,并且文件扩展名与文件的格式匹配
- 01-07静态库是.o文件的集合与弱符号
- 01-07标准库头文件:algorithm
- 01-07后缀为.ppt和.pps的文件无法选择打开方式