如果有人可以非常友好地告诉我如何在保存时将图片大小限制为指定尺寸(例如 150 x 200 像素),我会很高兴。如果不符合要求,则错误消息应指示所需尺寸。
但是,以下是将图片上传到图片框的代码。
Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Try
OpenFileDialog1.ShowDialog()
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
img = OpenFileDialog1.FileName.ToString
Catch
End Try
End Sub