看板 Visual_Basic 關於我們 聯絡資訊
1. 你會不會使用Timer ? 至少要了解 enabled & interval 兩個屬性 2. 你應該至少要用到一個counter 設interval=1000ms 每個tick counter+=1 counter 1 2 3 4 5 6 7 8 9 10 11 12 13 14 counter = 1~5 時 燈=紅 , 讀秒=counter counter = 6-8 時 燈=黃 , 讀秒=counter -? counter = 9-14時 燈=綠 , 讀秒=counter -? if counter= 14 後 再設counter=1 無限循環... 這是一種想法 GL ※ 引述《fjf1980 (VAIO才是NB的王道呀!)》之銘言: : 我要做一個練習題,可是想不到怎麼做。 : 開一個form專案,然後在form上有紅綠燈,旁邊有數字讀秒。 : 紅燈亮五秒,後黃燈亮三秒,後綠燈亮六秒。一直循環,亮的時候旁邊讀秒重新從1開始 : 這應該要用Timer做吧! 但我想不到怎麼做。 : 有沒有高手能給點方向。 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.117.128.13
fjf1980:我只有看過書上練習的蟑螂爬還有連緒跳動的球,timer其實 11/05 10:36
fjf1980:還沒很會使用 >"<。 11/05 10:37
humanfly:好了,工具箱+一個timer 進去,form_load 寫 11/05 18:13
humanfly:timer1.enable=true timer1.interval=1000 11/05 18:14
humanfly:然後timer1點兩下 在timer1_tick 裡寫你的程式 11/05 18:15