分类：电脑/网络-软件
问题：如何用VB做数字快速滚动效果,并单击按钮停止 
回答：Dim Toogle As BooleanDim i As IntegerPrivate Sub Timer1_Timer()If Toogle ThenIf i = 100 Then i = 0 : Ex Subi=i+1Label1.Caption = iDoEventsEnd IfEnd SubPrivate Sub Command1_Click()Toogle=Not ToogleEnd Sub用API也可以：Dim Toogle As BooleanDim i As IntegerPrivate Declare Function SetTimer Lib "user32" Alias "SetTimer" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As LongPrivate Declare Function KillTimer Lib "user32" Alias "KillTimer" (ByVal hwnd As Long, ByVal nIDEvent As Long) As LongPrivate Sub TIMERPROC(ByVal hwnd As Long, ByVal uMsg As Long, ByVal idEvent As Long, ByVal dwtime As Long)If i = 100 Then i = 0 : Exit Subi = i + 1Label1.Caption = iDoEventsEnd IfEnd SubPrivate Sub Form_Load()SetTimer Me.hWnd, 1, 1000, AddressOf TIMERPROCEnd SubPrivate Sub Command1_Click()Toogle=Not ToogleIf Toogle then KillTimer Me.hWnd,1ElseSetTimer Me.hWnd, 1, 1000, AddressOf TIMERPROCEnd Sub