VB编程:仿QQ聊天框的抖动效果
Dim a
Private Sub Command1_Click()
a = 0
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 50
Timer2.Enabled = False
Timer2.Interval = 8000
End Sub
Private Sub Timer1_Timer()
Static b As Integer
Timer2.Enabled = True
If a = 0 Then
Me.Top = Me.Top + 80
a = a + 1
ElseIf a = 1 Then
Me.Left = Me.Left + 80
a = a + 1
ElseIf a = 2 Then
Me.Top = Me.Top - 80
a = a + 1
ElseIf a = 3 Then
Me.Left = Me.Left - 80
a = 0
End If
b = b + 1
' Print b '抖动次数
End Sub
Private Sub Timer2_Timer()
If Timer1.Enabled = True Then
Timer1.Enabled = False
Timer2.Enabled = False
End If
End Sub