private void button1_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Image Files | *.JPG";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                var fName = openFileDialog.FileName;
                Image imge = Image.FromFile(fName);

                pbImageView.Image = imge;
            }
        }

 

PictureBox的属性【SizeMode】设置为【StretchImage】,所选择的图片会以PictureBox的Size为大小表示。

posted on 2014-01-23 14:25  西城诸葛  阅读(196)  评论(0编辑  收藏  举报