vb6 请问如何在label中让数字叠加显示?
比如一个循环0到10000一个command控制,单击后让label显示从0到10000PrivateSubCommand_Click()DimiAsIntegerfor...
比如一个循环0到10000
一个command控制,单击后让label显示从0到10000
Private Sub Command_Click()
Dim i As Integer
for i = 0 to 10000
Label1.Caption = i
next
End Sub
为什么label只显示最后的结果? 展开
一个command控制,单击后让label显示从0到10000
Private Sub Command_Click()
Dim i As Integer
for i = 0 to 10000
Label1.Caption = i
next
End Sub
为什么label只显示最后的结果? 展开
展开全部
你的代码只能显示最后的结果,你想慢慢的一个一个显示出来,能让别人感觉到数字的跳动?试一下下面的代码吧?
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To 10000
Label1.Caption = i
DoEvents
Sleep 300
Next
End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To 10000
Label1.Caption = i
DoEvents
Sleep 300
Next
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询