设窗体上有一个标签Label 1和一个计时器Timer1,Timer1的Interval属性被设置为1000, Enabled属性

8 查阅

设窗体上有一个标签Label 1和一个计时器Timer1,Timer1的Interval属性被设置为1000, Enabled属性被设置为True。要求程序运行时每秒在标签中显示一次系统当前时间。下列可以实现上述要求的事件过程是( )。

A. Private Sub Timer1_Timer() Labell.Caption=True End Sub

B.Private Sub Timer1_Timer() Labell.Caption=Time$ End Sub

C.Private Sub Timer1_Timer() Labell.Interval=1 End Sub

D.Private Sub Timer1_Timer() For k=1 To Timerl.Interval Label1.Caption=Timer Next K End Sub

参考答案:

B解析:本题考查的考点是有关计时器的。计时器的Interval属性决定了每隔多长时间触发一次Timer事件。本题中Interval设置为 1000,即每1秒触发一次Timer事件。在事件中把标签的Caption属性设置成为当前时间,用Time函数可以得到当前时间。

计算机二级