VB Code:
Private Sub Form_Load()
Me.ScaleMode = vbPixels
If Me.ScaleWidth < Image1.Width Then
Do
Me.Width = Me.Width + Screen.TwipsPerPixelX
Loop Until Me.ScaleWidth = Image1.Width
Else
Do
Me.Width = Me.Width - Screen.TwipsPerPixelX
Loop Until Me.ScaleWidth = Image1.Width
End If
If Me.ScaleHeight < Image1.Height Then
Do
Me.Height = Me.Height + Screen.TwipsPerPixelY
Loop Until Me.ScaleHeight = Image1.Height
Else
Do
Me.Height = Me.Height - Screen.TwipsPerPixelY
Loop Until Me.ScaleHeight = Image1.Height
End If
Image1.Left = 0
Image1.Top = 0
End Sub
It's a bit of a roundabout way of doing it, but I don't know how the borders of the form factor into the width/height.