Chapter #2 TOE CHART Creating the Color Game Application

Programming I
Creating a User Interface - Chapter #2
Creating the Color Game Application
Directions:
1. Open a new Visual Basic 2010 project
2. Name it: Color Game Application
3. Select the Form – Text – Color Game
4. Make sure to use the NAMES above in the TOE Chart!
Label
Adjust font to
Comic Sans MS –
Bold – 14pt
Name Form:
Color Game
Insert a
TableLayoutPanel –
Right click on the
panel to add a column
and row
TableLayout
Panel
ADD
BUTTONS
to Panel
Four
Buttons
5. TableLayoutPanel - There should be three rows and three columns.
6. Right click on the TableLayoutPanel – Edit Rows and Columns - Each Row and Column should be
33.33% (PERCENT)
7.
8.
9.
10.
11.
12.
Select the TableLayoutPanel – Select - CellBorderStyle – Outset Double
Select the TableLayoutPanel – Size – Type 300, 146
Adjust form size as needed
Add the color names to each button in the TableLayoutPanel
Add the four buttons at the bottom – Start Over - Print – Font – Exit
Scroll down under the toolbox – Under the Visual Basic PowerPacks section – Double click
PrintForm – You should now see this below your form (Make sure is says PrintForm1 at the bottom
and in the NAME section under properties!)
13. Scroll down under the toolbox – Dialogs – Double click FontDialog (Make Sure the NAME is
FontDialog)
Component
Tray
NOW WE ARE READY TO ENTER CODE!
Public Class MainForm
Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
exitButton.Click
Me.Close()
End Sub
Private Sub blueButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
blueButton.Click
blueButton.BackColor = Color.LightBlue
blueButton.Text = "Azul"
End Sub
Private Sub brownButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
brownButton.Click
brownButton.BackColor = Color.Brown
brownButton.Text = "Marron"
End Sub
Private Sub grayButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
grayButton.Click
grayButton.BackColor = Color.Gray
grayButton.Text = "Gris"
End Sub
Private Sub greenButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
greenButton.Click
greenButton.BackColor = Color.Green
greenButton.Text = "Verde"
End Sub
Private Sub orangeButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
orangeButton.Click
orangeButton.BackColor = Color.Orange
orangeButton.Text = "Anaranjado"
End Sub
Private Sub pinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
pinkButton.Click
pinkButton.BackColor = Color.Pink
pinkButton.Text = "Rosa"
End Sub
Private Sub purpleButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
purpleButton.Click
purpleButton.BackColor = Color.MediumPurple
purpleButton.Text = "Morado"
End Sub
Private Sub redButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
redButton.Click
redButton.BackColor = Color.Red
redButton.Text = "Rojo"
End Sub
Private Sub yellowButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
yellowButton.Click
yellowButton.BackColor = Color.Yellow
yellowButton.Text = "Amarillo"
End Sub
Private Sub startOverButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
startOverButton.Click
blueButton.BackColor = Color.White
brownButton.BackColor = Color.White
grayButton.BackColor = Color.White
greenButton.BackColor = Color.White
orangeButton.BackColor = Color.White
pinkButton.BackColor = Color.White
purpleButton.BackColor = Color.White
redButton.BackColor = Color.White
yellowButton.BackColor = Color.White
End Sub
Private Sub printButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
printButton.Click
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()
End Sub
Private Sub fontButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
fontButton.Click
fontDialog.Font = Me.Font
fontDialog.ShowDialog()
Me.Font = fontDialog.Font
End Sub
End Class
Now it’s time to add your SPLASH SCREEN!
1. Click Project in the menu bar – Add New Item
2. Scroll down and double click Splash Screen
3. Click the ApplicationTitle – Change the font to Segoe UI, 18pt – Change Text to: Color Game By:
(Your Name)
4. Click the Version label control, and then set its font property to Segoe UI, 9pt – Change Text to:
Version 1.00
5. Click the Copyright, and then set its font property to Segoe UI, 9pt – Change Text to: Copyright
@ 2013
6. Go to View – Other Windows – Solution Explorer – Select - My Project – Double Click
7. Splash Screen – Select Drop Down Arrow – Select SplashScreen1
8. Select Assembly Information - change the title to Color Game By (Your Name) - Change the
Copyright: Copyright @ 2013