帮忙解释一个关于拖动的程序

来源:百度知道 编辑:UC知道 时间:2024/05/21 02:54:15
Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Static a As Boolean ’这句什么意思
If Not a Then ‘这句什么意思,a没有值如何判断
Print "aa"
a = True
End If
End Sub
该程序用途是什么?谢谢了

Private Sub Picture1_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Static a As Boolean ’定义一个静态变量,静态变量的好处就是它的值在执行完这个SUB后,仍会保留
If Not a Then ‘如果Not a <>0 ,也就是a<>-1,(因为只有not(-1)=0)就执行下面的语句,否则就不执行。
Print "aa"
a = True
End If
End Sub
该程序是用来判断一个控件是不是第一次被拖动过来,如果是,就打印aa,如果不是就什么也不做。