回 帖 发 新 帖 刷新版面

主题:timer问题

怎么在StatusBar中动态显示当前系统时间.
谢谢!!

回复列表 (共2个回复)

沙发

statusBar1的属性Panels中追加一个statusbarpabel1然后卸下下面的代码即可(别忘记timer1的eEnabled属性设为true)
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        StatusBar1.ShowPanels = True
        
        StatusBar1.Panels(0).Text = "time:" & Now.ToLongTimeString
    End Sub

板凳

要自己做一个时间控制器的

Private Sub Form14_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Me.StatusBarPanel1.Text = TimeString
        Timer1.Interval = 100
        Timer1.Start()
    End Sub

我来回复

您尚未登录,请登录后再回复。点此登录或注册