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

admin2013-04-11  37

问题 设窗体上有一个标签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函数可以得到当前时间。
转载请注明原文地址:https://jikaoti.com/ti/z0O0FFFM
0

最新回复(0)