1樓:人文
frmtimer窗體控制元件:
commandbutton * 2
picturebox * 1
pictureclip(注:**剪下控制元件) * 1
timer * 3
(注:此處只給出了控制元件型別,控制元件名祥見**)
frmtimer 的**
option explicit
public t as integer, str as string
public h as integer, m as integer, s as integer
private sub show_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.paintpicture pctimer.graphiccell(n), pos, 0
pos = pos + 300
end if
next
end sub
private sub cmdrestart_click() '秒錶的回零
h = 0
m = 0
s = 0
str = ""
cmdstart.caption = "開始"
timer1.enabled = false: str = "00:00:00"
clscall 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
clsend sub
private sub mnucuntdwnclock_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
clscall show_led(pictimer, str)
end sub
private sub timer2_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
clscall show_led(pictimer, str)
else
pictimer.visible = false
clsfrmtimer.print "時間到"
timer2.enabled = false
end if
end sub
private sub timer3_timer() '時鐘顯示過程
str = cstr(now)
call show_led(pictimer, str)
clsend sub
frmtimer窗體控制元件:
text * 3
commandbuton * 1
label * 3
(注:控制元件名稱參照**)
frmset 的**
option explicit
private sub cmdcuntstart_click()
frmtimer.h = val(txtinput(0))
frmtimer.m = val(txtinput(1))
frmtimer.s = val(txtinput(2))
if frmtimer.h + frmtimer.m + frmtimer.s = 0 then
call msgbox("輸入錯誤,請重新輸入", 48, "多功能計時器")
else
frmtimer.timer2.enabled = true
unload frmset
end if
end sub
2樓:匿名使用者
現在有沒有解決,如果解決了能不能給我發一下,謝謝,一定給積分
VB的計時器怎樣能搞小動畫,VB的計時器怎樣能搞一個小動畫。
秋色烽火 dim vy 自增量 private sub command1 click timer1.enabled not timer1.enabled end sub private sub form load vy 60 自增量 timer1.interval 100end sub privat...
關於VB問題做倒計時器,要求最後10秒有提示音
正在給你做,晚上給你。 使用timer控制元件 聲音的使用beep vb6.0倒計時程式怎麼再最後10秒出現滴滴滴的警示音 心隨心潮 在窗體上畫一個timer控制元件 一個按鈕,一個progressbar控制元件 需要新增部件microsoft windows common controls 6.0...
VB中怎樣製作計時器?能夠設定倒計時的時間,並進行倒計時
1 開啟vb6.0,新建一個工程,在窗體中新增三個命令按鈕,caption分別改為 設定倒計時 啟動倒計時 繼續 將窗體form1的caption屬性改為 倒計時 新增一個計時器控制元件,新增一個文字框。2 將文字框的text屬性清空,將字型font屬性調整為小四,便於觀察,將背景色屬性backco...