Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.
Private Function ScaleImage(ByVal imgTemp As Image, ByVal box As PictureBox) As Graphics Dim fSize As String Dim iNewx As Integer = 0 Dim iNewy As Integer = 0 Dim oldBMP As New Bitmap(CInt(imgTemp.Width), CInt(imgTemp.Height)) 'Determine which side is larger than the canvas, If ImageTooWide(imgTemp) And ImageTooTall(imgTemp) Then '...and if both are larger, pick the larger side. If imgTemp.Height > imgTemp.Width Then fSize = "height" Else fSize = "width" End If Else '... Other wise pick the one that is larger. If ImageTooWide(imgTemp) Then fSize = "width" If ImageTooTall(imgTemp) Then fSize = "height" End If Select Case fSize Case "width" iNewx = picBannerBox.Width iNewy = iNewx / imgTemp.Width * imgTemp.Height Case "height" iNewy = picBannerBox.Height iNewx = iNewy / imgTemp.Height * imgTemp.Width End Select Dim newBMP As New Bitmap(iNewx, iNewy) 'Create a blank, new graphic that is the correct *new* size Dim gt_dest As Graphics = Graphics.FromImage(newBMP) 'Draw our picture onto it, scaling it... gt_dest.DrawImage(imgTemp, 0, 0, iNewx + 1, iNewy + 1) 'Draw new image to picBannerBox '???????????? End Function
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.