Dim W As Integer, H As Integer
Dim X As Integer, Y As Integer
Dim Back As Boolean
Private Sub Form_Load() '设置固定属性
  P1.AutoSize = True
  P1.Left = 0
  P1.Top = 0
  P2.AutoSize = True
  P2.Visible = False
  Reset
End Sub
Private Sub Reset()  '重置有关变量及属性
  Back = False
  W = P2.Width
  H = P2.Height
  Form1.Width = W
  Form1.Height = H + 700 '加菜单的高度
  P1.Width = W
  P1.Height = H
  Stopped
End Sub
Private Sub Stopped() '停止所有定时器
  Timer0.Enabled = False
  Timer1.Enabled = False
  Timer2.Enabled = False
  Timer3.Enabled = False
  Timer4.Enabled = False
  Timer5.Enabled = False
  Timer6.Enabled = False
End Sub
Private Sub 特技_Click(Index As Integer) '选择菜单
  Static n  As Integer
  n = n + 1
  If n > 4 Then n = 1 '四幅图片不断变换
  P2.Picture = LoadPicture(n & ".jpg")
  Reset
  P1.Cls
  Select Case Index
    Case 0         '推出
      X = W / 2: Y = H / 2
      Timer0.Enabled = True
    Case 1         '拉近
      X = 0: Y = 0
      Timer1.Enabled = True
    Case 2         '推拉
      X = W / 2: Y = H / 2
      Timer2.Enabled = True
    Case 3         '百叶窗
      X = 0: Y = 0
      Timer3.Enabled = True
    Case 4         '马赛克
      Timer4.Enabled = True
    Case 5         '拉幕
      X = 0: Y = 0
      Timer5.Enabled = True
    Case 6         '滚动
      X = 0
      Timer6.Enabled = True
  End Select
End SubPrivate Sub Timer0_Timer()              '推出
  X = X - W / 100: Y = Y - H / 100
  If X <= 0 Or Y <= 0 Then Stopped
  P1.PaintPicture P2.Picture, 0, 0, W, H, X, Y, W - 2 * X, H - 2 * Y
End SubPrivate Sub Timer1_Timer()   '拉近
  P1.PaintPicture P2.Picture, 0, 0, W, H, X, Y, W - 2 * X, H - 2 * Y
  X = X + W / 100: Y = Y + H / 100 '初值为0
  If X >= W / 2 Or Y >= H / 2 Then Stopped
End SubPrivate Sub Timer2_Timer()            '推拉
  If Back Then
    X = X + W / 100: Y = Y + H / 100
    If X >= W / 2 Or Y >= H / 2 Then Back = Not Back
  Else
    X = X - W / 100: Y = Y - H / 100
    If X <= 0 Or Y <= 0 Then Back = Not Back: X = 0: Y = 0
  End If
  P1.PaintPicture P2.Picture, 0, 0, W, H, X, Y, W - 2 * X, H - 2 * Y
End SubPrivate Sub Timer3_Timer()  '百叶窗
  Dim i As Integer, j As Integer, m As Integer, n As Integer
  m = W / 20: n = H / 20
  X = X + W / 500: Y = Y + H / 500  '初值为0
  If X >= m And Y >= n Then Stopped
  For i = 0 To 20
    For j = 0 To 20
    P1.PaintPicture P2.Picture, i * m, j * n, , , i * m, j * n, X, Y
  Next j, i
End SubPrivate Sub Timer4_Timer()  '马赛克
  Dim i As Integer, m As Integer, n As Integer, xx As Integer, yy As Integer
  Static c As Integer
  c = c + 1
  If c > 100 Then P1.PaintPicture P2.Picture, 0, 0: c = 0
  m = W / 100: n = H / 100
  For i = 1 To 50 + c * 10
    xx = Rnd * (W - m - 50)
    yy = Rnd * (H - n - 50)
    P1.PaintPicture P2.Picture, xx, yy, , , xx, yy, m, n
  Next i
End SubPrivate Sub Timer5_Timer()  '拉幕
  X = X + W / 100: Y = Y + H / 100 '初值为0
  P1.PaintPicture P2.Picture, W / 2 - X, 0, , , W / 2 - X, 0, 2 * X, H
  If X > 0.51 * W Then Timer5.Enabled = False
End SubPrivate Sub Timer6_Timer() '滚动
  X = X + W / 200  '初值为0
  If X >= W Then Stopped
  P1.PaintPicture P2.Picture, W - X, 0, , , 0, 0, X, H
End Sub