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为大小表示。
选择一个图片文件,并且用PictureBox表示在Form上
原文:http://www.cnblogs.com/yume2015/p/3531123.html