I am new to vb.NET and I have decided to make an image viewer, and what I want to do is resize the image it loads to fit the picture box, how do I do this? My image is a System.Drawing.Image object.
tomtetlaw
-1
Posting Pro
Recommended Answers
Jump to Posttry this:
Public Sub ResizeImage(ByVal pathToImg As String, ByVal pictureCtrl As PictureBox, Optional ByVal SizeMode As PictureBoxSizeMode = PictureBoxSizeMode.CenterImage) Try pictureCtrl.Image = Nothing pictureCtrl.SizeMode = SizeMode If System.IO.File.Exists(pathToImg) Then Dim imgOrg, imgShow As Bitmap Dim g As Graphics Dim divideBy, divideByH, divideByW As Double imgOrg = DirectCast(Bitmap.FromFile(pathToImg), …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.