' Basic Programming
' Ch 7 Demo #5
' Mr. Minich
' purpose - to illustrate the MouseDown, MouseUp, and MouseMove events

Option Explicit

Private Sub Form_Load()
   Form1.ScaleMode = 0
   Form1.ScaleHeight = 100
   Form1.ScaleWidth = 100
   lblMessage.Caption = "Don't click the mouse."
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   lblMessage.Caption = "You shouldn't have done that"
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
   lblXPosition.Caption = X
   lblYPosition.Caption = Y
End Sub

Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

   If (Not (X > 0 And X < 50 And Y > 0 And Y < 50)) Then
      Form1.BackColor = vbBlack
      MsgBox "The bomb has exploded."
      Restart
   Else
      MsgBox "You are lucky"
      lblMessage.Caption = "Don't click the mouse."
   End If

End Sub

Private Sub Restart()
   Form1.BackColor = vbButtonFace
   lblMessage.Caption = "Don't click the mouse."
End Sub