April 2006
Beginner
1114 pages
98h 16m
English
form.Zoom [= setting]
Sets or returns the percentage to scale the contents of the form or frame by. Must be between 10 and 400. Zoom doesn’t change the size of the form or frame. The following code zooms in or out on a background picture depending on which mouse button is pressed:
Private Sub UserForm_Initialize( )
' Load a background picture.
Me.Picture = LoadPicture(ThisWorkbook.Path & "\turtle.jpg")
' Change mouse pointer.
Me.MousePointer = fmMousePointerCustom
Me.MouseIcon = LoadPicture(ThisWorkbook.Path & "\magnify.ico")
End Sub
Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift_
As Integer, ByVal X As Single, ByVal Y As Single)
On Error Resume Next
' If left button, zoom in.
If Button = 1 Then
Me.Zoom = Me.Zoom * 1.1
' If right button, zoom out.
ElseIf Button = 2 Then
Me.Zoom = Me.Zoom * 0.9
End If
On Error GoTo 0
End SubRead now
Unlock full access