I want the pictures to automatically resize to fit in the picturebox.
My code is currently:
Code:
Public Class ViewerForm
Private Sub btnSelectPicture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectPicture.Click
If ofdSelectPicture.ShowDialog = DialogResult.OK Then ' Show open file dialog box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName) ' Load the picture into the picture box.
Me.Text = "Picture Viewer(" & ofdSelectPicture.FileName & ")" ' Show the name of the file in the form's caption.
' Make it resize the picture to fit the PictureBox
End If
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
' Close the window and exit the application.
Me.Close()
End Sub
End Class
I'm not releasing this or anything because It's a simple program. I'm using this as a personal viewer.
It opens faster than any other picture viewer I ever seen so I like it
IF YOU HELP ME ALSO MENTION ME!
Posts 1–11 of 11 · Page 1 of 1
Post a Reply
Tags for this Thread
None
Originally Posted by iFaceBook
I want the pictures to automatically resize to fit in the picturebox.
My code is currently:
Code:
Public Class ViewerForm
Private Sub btnSelectPicture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectPicture.Click
If ofdSelectPicture.ShowDialog = DialogResult.OK Then ' Show open file dialog box.
picShowPicture.Image = Image.FromFile(ofdSelectPicture.FileName) ' Load the picture into the picture box.
Me.Text = "Picture Viewer(" & ofdSelectPicture.FileName & ")" ' Show the name of the file in the form's caption.
' Make it resize the picture to fit the PictureBox
End If
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
' Close the window and exit the application.
Me.Close()
End Sub
End Class
I'm not releasing this or anything because It's a simple program. I'm using this as a personal viewer.
It opens faster than any other picture viewer I ever seen so I like it
IF YOU HELP ME ALSO MENTION ME!
A picturebox has a property called "SizeMode" so just change it to "StretchImage" in the designer, or put this in your code: