c # open the file library

a using (OFD = new new OpenFileDialog OpenFileDialog ())
                    {
                        ofd.Title = "Please select the picture you want to insert";
                        ofd.Filter = "JPG picture | * .jpg | BMP images | * .bmp | Gif images | * .gif" ;
                        ofd.CheckFileExists = to true;
                        ofd.CheckPathExists = to true;
                        ofd.Multiselect = to false;

                        IF (ofd.ShowDialog () == DialogResult.OK)
                        {
                             path = ofd.FileName;
                            picHeadImg.ImageLocation = path; // the PictureBox
                             

                        }
                        the else

                        {

                            MessageBox.Show ( "You have no choice picture", "message alert");

                        }

                    }

Guess you like

Origin www.cnblogs.com/ruiyuan/p/11445692.html