Dim fh As Integer
Dim fw As Integer
Dim ih As Integer
Dim iw As Integer
Dim p As Integer
Private Sub Form_Load()
p = 10
fh = imagefrm.Height
fw = imagefrm.Width
ih = Image1.Height
iw = Image1.Width
'now set initial position of the image on the form
Image1.Left = (fh / 2) - (iw / 2)
Image1.Top = (fw / 2) - (ih / 2)
'insert values in the combo box
For k = 0 To 9
Percentages.AddItem p
p = p + 10
Next
End Sub
Private Sub Percentages_Click()
'use variables ih and iw to ensure that changes to the
'image size are based on the original dimensions
Image1.Height = ih * (Percentages.Text / 100)
Image1.Width = iw * (Percentages.Text / 100)
'ensure that the location of the image is based on its new size
Image1.Left = (imagefrm.Width / 2) - (Image1.Width / 2)
Image1.Top = (imagefrm.Height / 2) - (Image1.Height / 2)
End Sub