by Jorge Loubet Jr. (1 Submission)
Category: Games
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Sat 16th October 1999
Date Added: Mon 8th February 2021
Rating:
(1 Votes)
A funny way to make your control escape from the mouse pointer
'Your users are going to hate that.
'In this example you have to put a Command Button on your form and copy this code
'you have to put controls that have top and left properties.
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
'here you have to especify the speed of the control.
s = 10
'Here you especify the name of the control you want to go away
With Command1
If Y < .Top Then
.Top = .Top + s
End If
If Y > .Top Then
.Top = .Top - s
End If
If X < .Left Then
.Left = .Left + s
End If
If X > .Left Then
.Left = .Left - s
End If
End With
End Sub