你好,我想问一下你那有VB课程设计的多功能计时器的答案吗,要求有时钟,秒表和倒计时功能,还有最初的... 20

你好,我想问一下你那有VB课程设计的多功能计时器的答案吗,要求有时钟,秒表和倒计时功能,还有最初的界面我不知道是怎么弄得,能不能帮帮忙呢^_^... 你好,我想问一下你那有VB课程设计的多功能计时器的答案吗,要求有时钟,秒表和倒计时功能,还有最初的界面我不知道是怎么弄得,能不能帮帮忙呢^_^ 展开
 我来答
胡春磊937
2012-06-27
知道答主
回答量:5
采纳率:0%
帮助的人:7992
展开全部
Option Explicit
Public t As Integer, str AsString
Public h As Integer, m AsInteger, s As Integer

Private SubShow_LED(picTimer As PictureBox, str As String)
'显示图片的通用过程
Dim s As String * 1
Dim pos As Integer
Dim n As Integer
Dim i As Integer
For i = 1 To Len(str)
s = Mid(str, i, 1)
n = -1
Select Case s
Case "0" To "9"
n = CInt(s)
Case ":"
n = 10
Case "-"
n = 11
Case "."
n = 12
Case "a", "A"
n = 13
Case "p", "P"
n = 14
Case " "
n = 15
End Select
If n <> -1 Then
picTimer.PaintPicturePCTimer.GraphicCell(n), pos, 0
pos = pos + 300
End If
Next
End Sub

Private SubcmdRestart_Click() '秒表的回零
h = 0
m = 0
s = 0
str = ""
cmdStart.Caption = "开始"
Timer1.Enabled = False: str ="00:00:00"
Cls
Call Show_LED(picTimer, str)
End Sub

Private Sub cmdStart_Click()'秒表的开始和暂停控制
If cmdStart.Caption = "开始" Then
h = 0
m = 0
s = 0
cmdStart.Caption = "暂停"
Timer1.Enabled = True
cmdRestart.Enabled = False
Exit Sub
ElseIf cmdStart.Caption = "暂停" Then
cmdStart.Caption = "继续"
Timer1.Enabled = False
cmdRestart.Enabled = True
Exit Sub
Else
cmdStart.Caption = "暂停"
Timer1.Enabled = True
cmdRestart.Enabled = False
Exit Sub
End If
End Sub

Private Sub Form_Load() '窗体加载
Call mnuClock_Click
End Sub

Private Sub mnuClock_Click()'时钟
picTimer.Cls
Me.Cls
Timer1.Enabled = False
Timer2.Enabled = False
cmdStart.Visible = False
cmdRestart.Visible = False
frmTimer.Caption = "时钟"
Timer3.Enabled = True
picTimer.Visible = True
Cls
End Sub
Private SubmnuCuntDwnClock_Click() '倒计时
picTimer.Cls
Me.Cls
Timer1.Enabled = False
Timer3.Enabled = False
cmdStart.Visible = False
cmdRestart.Visible = False
frmSet.Visible = True
frmTimer.Caption = "倒计时钟"
picTimer.Visible = True
End Sub

Private Sub mnuExit_Click()'退出选项
Unload frmTimer: Unload frmSet
End Sub

Private Sub mnuStopwatch_Click()'秒表
picTimer.Cls
Me.Cls
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
cmdStart.Visible = True
cmdRestart.Visible = True
frmTimer.Caption = "秒表"
picTimer.Visible = True
End Sub

Private Sub Timer1_Timer() '秒表计时过程
str = ""
s = s + 1
If s = 100 Then '秒表数字显示的处理
s = 0
m = m + 1
If m = 60 Then
m = 0
h = h + 1
If h = 24 Then
h = 0
End If
End If
End If

If h < 10 Then '数字显示格式的处理
str = str & 0 & h
Else: str = str & h
End If
If m < 10 Then
str = str & ":" & 0 &m
Else: str = str & ":" & m
End If
If s < 10 Then
str = str & ":" & 0 &s
Else: str = str & ":" & s
End If
Cls
Call Show_LED(picTimer, str)
End Sub

Private SubTimer2_Timer() '倒计时计时过程
picTimer.Cls
str = ""
t = h * 3600 + m * 60 + s
If t >= 1 Then
s = s - 1
If s = -1 Then
s = 59
m = m - 1
End If
If m = -1 Then
m = 59
h = h - 1
End If
If h < 10 Then
str = str & "0" & h
Else
str = str & ":" & h
End If
If m < 10 Then
str = str & ":" &"0" & m
Else
str = str & ":" & m
End If
If s < 10 Then
str = str & ":" &"0" & s
Else
str = str & ":" & s
End If
Cls
Call Show_LED(picTimer, str)
Else
picTimer.Visible = False
Cls
frmTimer.Print "时间到"
Timer2.Enabled = False
End If
End Sub

Private Sub Timer3_Timer() '时钟显示过程
str = CStr(Now)
Call Show_LED(picTimer, str)
Cls
End Sub

Option Explicit
Private SubcmdCuntStart_Click()
frmTimer.h = Val(txtInput(0))
frmTimer.m = Val(txtInput(1))
frmTimer.s = Val(txtInput(2))
If frmTimer.h + frmTimer.m + frmTimer.s = 0Then
Call MsgBox("输入错误,请重新输入", 48,"多功能计时器")
Else
frmTimer.Timer2.Enabled = True
Unload frmSet
End If
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
占成9q
2020-12-28
知道答主
回答量:1
采纳率:0%
帮助的人:544
展开全部
我也求这个,快被逼疯了,楼主还有答案吗(눈_눈)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
weixiaojun6
2012-06-24
知道答主
回答量:29
采纳率:100%
帮助的人:12.9万
展开全部
怎么给你
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式