| 1. |
Create an application to control a standard
traffic light. The name of the form should be frmtraffic. The traffic
light will have a red light at the top, a yellow light in the middle and
a green light at the bottom. Buttons will control the changing of the
traffic light. |
| . |
|
| 2. |
Create a new application and name the
project traffic light. |
| 2.1 |
The name of the form should be
frmtrafficlight. |
| 2.2 |
Change the form’s Text property to
Traffic Light. |
| 2.3 |
Set the WindowState property to Maximized. |
| 2.4 |
Assign the filename trafficlight.vb to the
form file object. |
| 2.5 |
Set the project’s startup form to
frmtrafficlight. |
| . |
|
| 3. |
In the center of the top of the form,
create a picture box named piclight. |
| 3.1 |
Set the Size property of the piclight
object to 112,152. |
| 3.2 |
Set the SizeMode property of the piclight
object to StretchImage. |
| . |
|
| 4. |
Create a button below the piclight object
and align it on the left side. |
| 4.1 |
Call it btnred and set the button’s Text
property to the word “Red”, without the quotes. |
| 4.2 |
Pick an appropriate font and size for the
word Red. |
| 4.3 |
Double click on the button object to enter
the code window and add the appropriate code to the button object to
assign the red light icon to the image property of the piclight object.
The icon is located in the
C:\ProgramFiles\MicrosoftVisualStudio.Net\Common7\Graphics\Icons\Traffic
folder and the red light icon is called TRFFC10C. |
| 4.4 |
To transfer the image, use the following
code: piclight.Image =
Image.FromFile("trffc10c.ico") |
| . |
|
| 5. |
Repeat step 3 above for the yellow light
and green light buttons using the icons TRFFC10A for green and TRFFC10B
for yellow. |
| . |
|
| 6. |
Create a fourth button and place it below
the Red, Yellow and Green buttons. |
| 6.1 |
Call it btnexit and set the button’s Text
property to the word “Exit”, without the quotes. |
| 6.2 |
Pick an appropriate font and size for the
word Exit. |
| 6.3 |
Double click on the button object to enter
the code window and add the appropriate code to the button object to end
the application. |
| . |
|
| 7. |
Copy the three icons from the
C:\ProgramFiles\MicrosoftVisualStudio.Net\Common7\Graphics\Icons\Traffic
folder into the bin folder of the traffic light application. |
| . |
|
| 8. |
Save the solution, then start and test the
application. Close the application. |
|
|