Hey. In my program I have it set so that the user can load a picture. I have a track bar that I want to use so that they can resize it. My code kinda works, but I dont know if its the right way to do it, and It's slightly buggy... can anyone help improve what I have?

VB Code:
  1. Dim resized As Bitmap
  2.  
  3.         If lastTrackBarvalue < TrackBar1.Value Then 'user is making picture bigger
  4.             resized = New Bitmap(Image.FromFile(OpenImageDialog.FileName), PictureBoxNewImage.Image.Width * 1.1, PictureBoxNewImage.Image.Height * 1.1) 'each time reloads original pic to prevent distorting
  5.            
  6.         ElseIf lastTrackBarvalue > TrackBar1.Value Then 'user is making picture smaller
  7.             resized = New Bitmap(Image.FromFile(OpenImageDialog.FileName), PictureBoxNewImage.Image.Width / 1.1, PictureBoxNewImage.Image.Height / 1.1) 'each time reloads original pic to prevent distorting
  8.             La
  9.         End If
  10.  
  11.         If TrackBar1.Value = 0 Then 'resets to original because sometimes doesn't scale correctly
  12.             resized = New Bitmap(Image.FromFile(OpenImageDialog.FileName), pictureSize(1), pictureSize(0))
  13.            
  14.         End If
  15.  
  16.         LabelImageResizing.Text = "Image Resizing (" & TrackBar1.Value & ")"
  17.         PictureBoxNewImage.SizeMode = PictureBoxSizeMode.CenterImage
  18.         PictureBoxNewImage.Image = resized 'new larger image
  19.         lastTrackBarvalue = TrackBar1.Value

Part of the problem is that if you move the bar too quickly it misses some of the points to enlarge/decrease the picture. The middle part returns the original picture to its original size because if you move too fast then you can end up making the picture way too tiny and loosing the orignal dimensions.