如何编辑一个倒计时的电脑程序

如何编辑一个倒计时的电脑程序,第1张

在单元格B3中,输入系统时间:B3:

=TODAY()

在单元格D3中,输入计划结束日期

在单元键数裤格C3中,有两种方案:

一是从开始就进行倒计时,二是距结束日期为若干稿简天进行倒计时(设25天)。

当从开始就进行倒计时毕激:C3:

=D3-B3

当距结束日期为若干天进行倒计时:C3:

=IF(D3-B3<26,D3-B3,””)。

Dim Hours As Integer

Dim Minutes As Integer

Dim Seconds As Integer

Dim Time As Date

Private Sub Command2_Click()

Timer1.Enabled = True

End Sub

Private Sub Command1_Click()

Number = InputBox("输入倒计时时间,以秒为单位", "输入框", "100"拆旦)

Hours = Number / 3600

Minutes = (Number - Hours * 3600) / 60

Seconds = (Number - Hours * 3600 - Minutes * 60)

Time = TimeSerial(Hours, Minutes, Seconds)

Label1.Caption = Format$(Time, "hh") &":" &Format$(Time, "nn" _

)&":" &Format$(Time, "ss")

End Sub

Private Sub Form_Load()

Form1.Top = (Screen.Height - Form1.Height) / 2

Form1.Left = (Screen.Width - Form1.Width) / 2

Timer1.Interval = 1000

Hours = 0

Minutes = 0

Seconds = 0

Time = 0

End Sub

Private Sub Timer1_Timer()

Timer1.Enabled = False

If (Format$(Time, "hh") &":" &Format$(Time, "nn") &"旅亩扰:" &Format$(Time, "ss")) <>"00:00:00" Then 'Counter to continue lo _op until 0

Time = DateAdd("s", -1, Time)

Label1.Visible = False

Label1.Caption = Format$(Time, "hh") &":" &Format$(Time, "nn" _

) &":" &Format$(Time, "ss")

Label1.Visible = True

Timer1.Enabled = True

Else

Timer1.Enabled = False

Beep

Beep

End If

End Sub

'建Command1,Command2,timer1,label1. 试试吧,响铃从耳机耐启输出,


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12568852.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-26
下一篇 2023-05-26

发表评论

登录后才能评论

评论列表(0条)

保存