Write a program that includes five or more buttons and five or more labels. When the user clicks the buttons, random things occur to the buttons and labels. For example, clicking a button that says "Rain" could cause the background color of the form to change to blue. Or, clicking a button that says "Don't Click Me" could cause that button to turn invisible.
Be sure to immediately name all objects (buttons and labels) with proper prefixes as soon as you place them on the form.
You may include and animate PictureBoxes (i.e. graphics) in your project if you can figure out how to do so on your own. (Hint: Use the code for lblRocket below to animate the picture box across the screen when a button or the picture box itself is clicked.) See Per. 1 student Jasie if you need help.
Here are some example statements that will do interesting things in button Click methods:
lblBomb.Text = "BOOM"
lblBackColor = Color.Blue ' changes the background color of an object
lblForeColor = Color.HotPink ' changes the color of the text on an object
lblPhrase.Visible = False ' makes the object invisible
lblPhrase.Visible = True ' makes the object visible
lblPhrase.Top = 50 ' any number less than 300
lblPhrase.Left = 250 ' any number less than 300
btnBig.Width = 200 ' changes the width of an object
btnSmall.Height = 5 ' changes the height of an object
lblRocket.Left = lblRocket.Left + 10 ' moves the label to the right
lblRocket.Left = lblRocket.Left - 10 ' moves the label to the left
lblRocket.Top = lblRocket.Top + 10 ' moves the label down the screen
lblRocket.Top = lblRocket.Top - 10 ' moves the label up the screen
Me.BackColor = Color.White ' changes the background color of the whole form
Your
program must follow the Visual Basic Coding
Standards.
Name your project Chaos .
Staple your printouts in the following order:
- VB code
- The screen capture of your actual form window at runtime after a successful test case. See the instructor if you do not know how to create a screen capture.