我有:1 OpenFileDialog、1 PictureBox、2 TextBox
这是我到目前为止所得到的,但我只是坚持如何让图像的宽度自动检测并将图像宽度(以像素为单位)放在 TextBox1 中,并将高度放在 TextBox2 中。
有谁知道如何做到这一点,或者我可以用它吗?
Public Class Form1
Private sizew As Integer
Private sizey As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
OpenFileDialog1.CheckFileExists = True
OpenFileDialog1.ShowReadOnly = False
OpenFileDialog1.Filter = "All Files|*.*|Bitmap |*.bmp;*.dib|JPEG |*.jpg;*.jpeg;*.jpe;*.jfif|TIFF |*.tif;*.tiff |PNG |*.png"
OpenFileDialog1.FilterIndex = 1
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
End If
End Sub
End Class