|
Public Sub ResizePicture(startingPic As PictureBox, destinationPic As PictureBox)
'the horz. and vert. ratios ratioX = startingPic.ScaleWidth / destinationPic.ScaleWidth ratioY = startingPic.ScaleHeight / destinationPic.ScaleHeight 'for stats theTimer = Timer 'go through the startingPic's pixels For x = 0 To startingPic.ScaleWidth Step ratioX For y = 0 To startingPic.ScaleHeight Step ratioY 'get the color of the startingPic theColor = startingPic.Point(x, y) 'find the corresponding x and y values for the resized destination pic realX = ratioX ^ -1 * x realY = ratioY ^ -1 * y destinationPic.PSet (realX, realY), theColor Next y Next x MsgBox "It took " & Timer - theTimer & " seconds to increase the horizontal size by " & ratioX ^ -1 & " and the vertical size by " & ratioY ^ -1 & "." End Sub |