Syllabus

Home

Class Resources

 

CS-100 In-Class Project: Traffic Light

 

Details:

  1. Draw the form above.
  2. Name the form frmTraffic.
  3. Set the form's Text property to "Traffic Light"
  4. The traffic light is made up of one label object as a background and three other label objects drawn on top. Name them lblBack, lblTop, lblMiddle and lblBottom.
  5. Set the backcolor of the background label to a dark green and the other three labels drawn on top to black.
  6. There are four buttons on the right. Name them btnStop, btnCaution, btnGo, and btnQuit.
  7. Set the text on each as shown.
  8. Double click on the "Stop" button to activate the code window.
  9. Add code that will make the lblTop become red when the click event for the button btnStop executes.
  10. Add code that will make the lblMiddle become yellow when the click event for the button btnCaution executes.
  11. Add code that will make the lblBottom become green when the click event for the button btnGo executes.
  12. Can you make the light behave like a real traffic light so that only the red, yellow or green lights are on? (The other two will be off or black.)
  13. Save this form to your floppy disk or other media.