打开图片

 

OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title = "选择图片";

            ofd.InitialDirectory = "C://Documents and Settings//Administrator//My Documents//My Pictures";

            ofd.Filter = "All files(*.*)|*.*";

            //“文本文件(*.txt)|*.txt|所有文件(*.*)|*.*

            ofd.FilterIndex = 1;

            if (ofd.ShowDialog() == DialogResult.OK)

            {

                pbBrowse.Image = Image.FromFile(ofd.FileName);

            }

 

你可能感兴趣的:(打开图片)