廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 3371 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
傻妞佩ㄦ
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[Basic][求助] VB TIMER 使用
這是我寫的

我想要寫一個 自動用LABEL 計算出 時分秒 是用加的 不是倒數 麻煩各位大大 幫忙


Private Sub Label11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label11.Click

Dim Minutein, Secondin, Hourin As Integer

Timer1.Interval = 1000
Timer1.Enabled = True
Minutein = 0 & ..

訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容



獻花 x0 回到頂端 [樓 主] From:台灣凱擘 | Posted:2010-10-01 13:09 |
ebolaman 手機 會員卡
個人文章 個人相簿 個人日記 個人地圖
特殊貢獻獎

級別: 副版主 該用戶目前不上站
版區: 程式設計
推文 x38 鮮花 x458
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

檔案如果打不開,請調整 "相容性" ,(檔案右鍵 > 內容 > 相容性 > 使用相容性....)

如果你想要別人做好的碼表,可以參考這裡,碼表多到爆炸了:http://win.softpedia.com/dyn-search.p...topwatch&x=0&y=0










複製程式
Option Explicit

Dim RecTi(2) As Integer, UpLimTi(2) As Integer
Dim RZNow As Boolean

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyEscape Or KeyCode = vbKeySpace Then
  Label_Ti_Click
End If

End Sub

Private Sub Form_Load()

Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2

End Sub

Private Sub Label_Ti_Click()

    Dim i As Integer
    
    '------ Check If Running ------
    If Timer_Accumulate.Enabled Then
      Timer_Accumulate.Enabled = False
      Label_Ti.Caption = "00:00:00"

        Exit Sub
    End If
    '------------------------------
    
    '-------- RZ ---------
    Label_Ti.Caption = "00:00:00"
    
    For i = 0 To 2
      RecTi(i) = 0
    Next i
    
    'RecTi(1) = 59: RecTi(0) = 56 '@@@ Only For Test
    'RecTi(2) = 23: RecTi(1) = 59: RecTi(0) = 56 '@@@ Only For Test
    
    UpLimTi(2) = 24: UpLimTi(1) = 60: UpLimTi(0) = 60
    
      RZNow = True
      Timer_Accumulate_Timer
      RZNow = False
    '---------------------
       
    '----- Start Counting -----
        Timer_Accumulate.Enabled = True
    '--------------------------

End Sub

Private Sub Timer_Accumulate_Timer()

Static JustColon As Boolean
Dim i As Integer
  
  If RZNow Then JustColon = False: Exit Sub
  
'------- Show The Time ------
Label_Ti.Caption = ShowTi(JustColon)
'----------------------------

  JustColon = Not JustColon

End Sub

Public Function ShowTi(ByVal IfShowColon As Boolean) As String

Dim i As Integer
Dim TempAcc As Boolean, tempS As String

'--------- Accumulate ---------
If IfShowColon Then
    RecTi(0) = RecTi(0) + 1
    For i = 0 To UBound(RecTi())
      RecTi(i) = RecTi(i) + IIf(TempAcc, 1, 0)
        TempAcc = False
      If RecTi(i) >= UpLimTi(i) Then RecTi(i) = 0: TempAcc = True
    Next i
End If
'------------------------------

'-------- String & Return --------
For i = UBound(RecTi()) To 0 Step -1
  tempS = tempS & Format(RecTi(i), String(Len(UpLimTi(i)), "0")) & IIf(i = 0, "", IIf(IfShowColon, ":", " "))
Next i
  ShowTi = tempS
'--------------------------------


End Function




本帖包含附件
zip StopWatch.rar   (2022-06-09 14:16 / 13 KB)   下載次數:5


[ 此文章被ebolaman在2010-10-09 07:07重新編輯 ]

此文章被評分,最近評分記錄
財富:50 (by 三仙) | 理由: ^^ 因為您的參與,讓程式設計更容易!!


My BOINC stats :

獻花 x1 回到頂端 [1 樓] From:台灣台灣寬頻 | Posted:2010-10-09 06:45 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.021546 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言