怎样在VB6.0中用TIMER空间作出一个20分钟的倒计时?大哥大姐,求代码
2个回答
展开全部
Dim a As Integer
Dim b As Integer
Dim c As Integer
Private Sub Form_Load()
Text1.Text = "20:00"
Timer1.Interval = 1000
a = 1200
End Sub
Private Sub Timer1_Timer()
a = a - 1
b = a \ 60
c = a - (b * 60)
Text1.Text = Trim(Str(b)) + ":" + Trim(Str(c))
End Sub
Dim b As Integer
Dim c As Integer
Private Sub Form_Load()
Text1.Text = "20:00"
Timer1.Interval = 1000
a = 1200
End Sub
Private Sub Timer1_Timer()
a = a - 1
b = a \ 60
c = a - (b * 60)
Text1.Text = Trim(Str(b)) + ":" + Trim(Str(c))
End Sub
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
一楼的没必要设置那么多全局变量的
Dim a As Integer
Private Sub Form_Load()
Text1.Text = "20:00"
Timer1.Interval = 1000
a = 1200
End Sub
Private Sub Timer1_Timer()
Dim b As Integer
Dim c As Integer
a = a - 1
b = a \ 60
c = a mod 60
Text1.Text = Trim(Str(b)) + ":" + Trim(Str(c))
End Sub
如果要让计时器永远在最前面,可以参考这段代码
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST& = -1
' 将窗口置于列表顶部,并位于任何最顶部窗口的前面
Private Const SWP_NOSIZE& = &H1
' 保持窗口大小
Private Const SWP_NOMOVE& = &H2
' 保持窗口位置
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
' 将窗口设为在所有窗口前端
End Sub
Dim a As Integer
Private Sub Form_Load()
Text1.Text = "20:00"
Timer1.Interval = 1000
a = 1200
End Sub
Private Sub Timer1_Timer()
Dim b As Integer
Dim c As Integer
a = a - 1
b = a \ 60
c = a mod 60
Text1.Text = Trim(Str(b)) + ":" + Trim(Str(c))
End Sub
如果要让计时器永远在最前面,可以参考这段代码
Option Explicit
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const HWND_TOPMOST& = -1
' 将窗口置于列表顶部,并位于任何最顶部窗口的前面
Private Const SWP_NOSIZE& = &H1
' 保持窗口大小
Private Const SWP_NOMOVE& = &H2
' 保持窗口位置
Private Sub Form_Load()
SetWindowPos Me.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
' 将窗口设为在所有窗口前端
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询