VB 状态栏动态显示时间

在赶毕业设计啊,我想在状态栏中动态显示时间,大侠帮帮忙啊!最好是详细一点啊,附上代码最好……
呵呵 我试试
谢谢你,haokeyy帮我解决了,非常感谢

1)在窗体上布置一个StatusBar和一个Timer

注:需要在控件“工具箱”上点鼠标右键-->“部件”--> "Mirosoft Windows Common Controls 6.0 (SP6)",然后才能看到StatusBar控件。

2)代码

Option Explicit

Private Sub Form_Load()
    ' 定时器的定时间隔为1秒(1000毫秒)
    Timer1.Interval = 1000
    ' 启动定时器
    Timer1.Enabled = True
    ' 显示当前时间
    StatusBar1.Panels(1).Text = Format(Time, "HH:mm:ss")
End Sub

Private Sub Timer1_Timer()
    ' 动态显示时间,每秒刷新一次
    StatusBar1.Panels(1).Text = Format(Time, "HH:mm:ss")
End Sub

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-12-01

VB6.0需要在窗体添加Timer控件和StatusBar 控件来实现状态栏动态显示系统时间。

    StatusBar 控件,StatusBar 控件提供窗体,该窗体通常位于父窗体的底部,通过这一窗体,应用程序能显示各种状态数据。StatusBar
    最多能被分成 16 个 Panel 对象,这些对象包含在 Panels 集合中。

    设置StatusBar 控件的Style = sbrSimple,StatusBar控件仅显示一个大面板。

    Timer 控件,通过引发 Timer 事件,Timer 控件可以有规律地隔一段时间执行一次代码。

    代码实例:

    Private Sub Form_Load()

        Timer1.Interval = 500

        StatusBar1.Style = sbrSimple

    End Sub


    Private Sub Timer1_Timer()

        If StatusBar1.SimpleText <> CStr(Time) Then

            StatusBar1.SimpleText = Time

        End If

    End Sub

第2个回答  2010-05-07
设置状态栏相应的panel的style属性即可。

sbrDate
动态显示日期

sbrTime
动态显示时间
第3个回答  2010-05-07
哪个动态栏?
用时钟控件,给你参考一下:
Private Sub Form_Load()
Timer1.Interval = 1000
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub本回答被提问者和网友采纳
第4个回答  2018-03-11

可在窗格样式里面选:6-sbrDate  或   5-sbrTime。

相似回答