網路城邦
上一篇 回創作列表 下一篇   字體:
模擬交通號誌
2010/05/04 10:33:02瀏覽1055|回應22|推薦0

利用三個TextBox的BackColor(背景顏色)來模擬交通號誌( Red,Yellow,Green) !

動作方式先比較簡單一點吧! First -> Green Light ON last for 5seconds and then Yellow Light ON and last for one second and then RedLight ON and last for 5seconds !

How to do it? timer控制項是不可缺的! 因有三個燈號,所以要使用到三個Timer !

So!要先知道Timer控制項吧! setting上有 "Enable"參數-> True or Flase 再來還有計時時間(Timer的計時單位是 1mS [1毫秒],所以在 Interval參數中填入要計時的次數,例如填入1000 , 則 1mS*1000=1Second!則一秒鐘動作!

想一下吧 ! how to change the light color : Red, Yellow , Green !

Have fun with this homework!

( 知識學習其他 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=yangfu&aid=4001626

 回應文章 頁/共 3 頁  回應文章第一頁 回應文章上一頁 回應文章下一頁 回應文章最後一頁

810147
homework
2010/06/01 20:42

404

14

林晉緯

http://wwws.sysh.tc.edu.tw/~h810147


40327
作業
2010/06/01 10:26

403

27

陳麗帆

http://wwws.sysh.tc.edu.tw/~h810116


810045
810045
2010/05/30 17:29

810045

45

蘇亭語

http://wwws.sysh.tc.edu.tw/~h810045/


810169
work
2010/05/27 23:40
高一四班
楊珣平
36號
http://wwws.sysh.tc.edu.tw/~h810169/VBhomework/20100518_810169.exe

H810172
紅綠燈作業
2010/05/24 22:11

H810172

39號

葉武翰

http://www.sysh.tc.edu.tw/~h810172

作業名為: 810172-紅綠燈

夫子(yangfu) 於 2010-05-25 11:49 回覆:

1.連結錯誤應該是 http://wwws.sysh.tc.edu.tw/~h810172 才對 ,不是 [www]是[wwws] ok!

2.檔案檢查過了!動作正確!



2010/05/19 22:08

我在Timer1打

        TextBox1.BackColor = Color.LightGray
        TextBox1.BackColor = Color.Green
        Timer1.Enabled = True
        Timer2.Enabled = False
        Timer3.Enabled = False

在Timer2打

        TextBox2.BackColor = Color.LightGray
        TextBox2.BackColor = Color.Yellow
        Timer1.Enabled = False
        Timer2.Enabled = True
        Timer3.Enabled = False

在Timer3打

        TextBox3.BackColor = Color.LightGray
        TextBox3.BackColor = Color.Red
        Timer1.Enabled = False
        Timer2.Enabled = False
        Timer3.Enabled = True

都只出現綠色而已耶!是不是我有哪裏打錯了?

夫子(yangfu) 於 2010-05-25 11:53 回覆:
在timer1.tick中你要控制textbox1 和 textbox2改變顏色!同時起動timer2!看你的code....請問textbox1.backcolor可以同時便lightgray和green嗎? 相同的錯誤出現在timer2中和timer3中!

810081
810081
2010/05/19 21:01

1. 402

2. 36號

3. 楊智筑

http://wwws.sysh.tc.edu.tw/~h810081/

夫子(yangfu) 於 2010-05-25 11:54 回覆:
Very Good! your file work correctly!

810054
810054
2010/05/19 20:21

1. 402

2. 9號

3. 吳庭熏

http://wwws.sysh.tc.edu.tw/~h810054/

夫子(yangfu) 於 2010-05-25 11:55 回覆:
OK! your file work correctly!

810158
高一 4班
2010/05/18 11:53

陳人豪 25號

http://wwws.sysh.tc.edu.tw/~h810158/

夫子(yangfu) 於 2010-05-25 11:56 回覆:
OK! your file work correctly!


等級:
留言加入好友
簡易交通號誌模擬機
2010/05/18 11:03
高一三班 三十八號 盧怡安
http://wwws.sysh.tc.edu.tw/~h810127/VBhomework/20100518.exe
夫子(yangfu) 於 2010-05-25 11:57 回覆:
OK! your file work correctly!
頁/共 3 頁  回應文章第一頁 回應文章上一頁 回應文章下一頁 回應文章最後一頁