User Interface:
1. BackColor Black
2. FormBorderStyle None. (See Table 2-5, page 108.) Note that there will be no [X] Close button. You will code the application to close automatically after it runs sixty seconds
3. Size 550x550 pixels
4. StartPosition CenterScreen
5. Four labels:
a. Name Label1
i. AutoSize False
ii. BackColor Red
iii. BorderStyle FixedSingle
iv. Location 0,0
v. Size 50x50
vi. Text “” (i.e., delete the contents of the Text property)
b. Name Label2 Note: You can select Label1, copy it to your clipboard, and paste it 3 times for each of Label2, Label3, and Label4. Then you will only need to change the BackColor and Location properties of each since the other properties are identical to Label1’s.
i. AutoSize False
ii. BackColor Blue
iii. BorderStyle FixedSingle
iv. Location 0,500
v. Size 50x50
vi. Text “”
c. Name Label3
i. AutoSize False
ii. BackColor Green
iii. BorderStyle FixedSingle
iv. Location 500,500
v. Size 50x50
vi. Text “”
d. Name Label4
i. AutoSize False
ii. BackColor Yellow
iii. BorderStyle FixedSingle
iv. Location 500,0
v. Size 50x50
vi. Text “”
6. A Timer
a. Enabled True
b. Interval 250 (that’s every ¼ of a second (250 milliseconds) that each label will take a step)
Code:
1. Class-level
a. A constant for the length and height of the form (550)
b. A constant for the length and height of a square label (50)
c. A constant for the maximum run time in seconds (60)
d. A Double variable to hold the number of seconds that the app has run, initialized to 0.0.
e. An instantiated Random object
f. A Label array exactly large enough to hold four labels. Note that, instead of As Integer or As Double or As String etc., this array will be declared As Label. This will allow you to reference all the labels by using a loop after the array has been populated (See Load Event handler, below).
2. Load Event handler
a. Write four assignment statements, one for each label, assigning Label1, Label2, Label3, and Label4 to the first four positions of the Label array. After this, you’ll be able to refer to each label by its index in the array, rather than by name.
3. Timer1 Tick Event handler
a. Add the timer’s Interval property * 0.001 to the class-level variable for app run time. Remember that the interval is in milliseconds, so you need to multiply it by 1/1000 to convert it to seconds.
b. If the app has run at least 60 seconds, then close the form ([login to view URL]()).
c. For Each lbl in the array of labels
i. At this point, lbl is one of the four labels.
ii. Generate a random Integer 0, 1, 2, or 3 and, using a Select Case statement, if that random is
1. 0: if it’s not at the top of the form (its Location.Y value is not 0), move lbl up 50 pixels
2. 1: if it’s not at the bottom of the form (its Location.Y value is not 500), move lbl down 50 pixels
3. 2: if it’s not at the left margin of the form (its Location.X value is not 0), move lbl left 50 pixels
4. 3: if it’s not at the right margin of the form (its Location.X value is not 500), move lbl right 50 pixels
iii. Note: In the steps above, try to use the class-level constants you declared instead of 50 and 500. Also note that your class-level constants are 50 and 550 (not 500), so how can you use both constants to make 500?