编程语言
首页 > 编程语言> > c# 打开文件库

c# 打开文件库

作者:互联网

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("你没有选择图片", "信息提示");

                        }

                    }

标签:文件,false,ofd,c#,OpenFileDialog,path,打开,true,图片
来源: https://www.cnblogs.com/ruiyuan/p/11445692.html