Mouse Click Event
Private Sub imgMove_Click()
imgMove.Move imgMove.Left + 750, imgMove.Top - 550
End Sub
Double Click Event
Private Sub Form_Load()
lstName.AddItem "Kambing"
lstName.AddItem "Gajah"
lstName.AddItem "Arnab"
lstName.AddItem "Ahmad"
lstName.AddItem "Zainab"
lstName.AddItem "Ali"
End Sub
-------------------------------------------------------------
Private Sub lstName_DblClick()
txtItem.Text = lstName.Text
End Sub
Drag and Drop Event
Private Sub picTarget_DragDrop(Source As Control, X As Single, Y As Single)
If TypeOf Source Is PictureBox Then
picTarget.Picture = Source.Picture
End If
End Sub
KeyPress Event
Private Sub txtText_KeyPress(KeyAscii As Integer)
KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub
Mouse Event
Private Sub cmdClear_Click()
frmMouseEvent.Cls
End Sub
Private Sub Form_Load()
DrawWidth = 10
ForeColor = RGB(255, 0, 0)
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Paint = True 'Code to enable printing
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Paint Then
PSet (X, Y) 'Draw a point
End If
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Paint = False 'Code to disable printing
End Sub
Timer
Private Sub Timer1_Timer()
If shpRed.Visible Then
shpYellow.Visible = True
shpRed.Visible = False
shpGreen.Visible = False
ElseIf shpYellow.Visible Then
shpYellow.Visible = False
shpGreen.Visible = True
shpRed.Visible = False
Else
shpYellow.Visible = False
shpGreen.Visible = False
shpRed.Visible = True
End If
End Sub

0 comments:
Post a Comment