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

admin2019-06-20  39

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

选项 A、Privme Sub Timerl_Timer()
  Labell.Caption=True
  End Sub
B、Private Sub Timer1_Timer()
  Labell.Caption=Time$
  End Sub
C、Private Sub Timerl_Timer()
  Labell.Interval=1
  End Sub
D、Privme Sub Timer1_Timer()
  For k=1 To Timer1.Interval
    Labell.Caption=Timer
  Next k
  End Sub

答案B

解析 Timerl的Interval属性值是1000,Enabled属性为True,说明定时器开始工作,每隔1000毫秒(即1秒)触发一次Timer事件,从而执行一次Timer事件过程。要想每秒在标签中显示一次系统时间,则在Timer事件过程中把系统时间赋给标签的Caption属性就能实现。故选B。
转载请注明原文地址:https://jikaoti.com/ti/owN0FFFM
0

相关试题推荐
最新回复(0)