|
|
|
|
|
The Microsoft Visual Basic 2010 member of the
Microsoft Visual Studio 2010 Professional |
|
FaceGame_10 application ..., describe how to use Microsoft Visual Basic 2010 to create game
application
The
Classes used in this application
System.Console, System.Drawing, System.Resources, ImageList, Label, MainMenu,
Panel,
PictureBox, Timer,
ToolBar

- Name
-
FaceGame_10
-
Game Software.
- Developed with
Microsoft Visual Basic 2010.
-
Functions ...
-
Arrange boxes using the mouse
- Demo
Game
|
- Requirements:
Microsoft Visual Studio 2010 Professionnal.
If you want to run it:
- Remove the
read-only attribute of all files in
the folder -
C:\VBN_FGame_10
- Run the
Microsoft Visual Studio 2010 Professional.
- From
File menu, choose Open
then choose
Project/Solution, the
Open Project dialog box
appears, select the FaceGame_10 project file -Type:
Microsoft Visual Studio Solution
(C:\FaceGame_10\FaceGame_10.sln)
and then click Open.
- From
Debug menu, choose and click
Start Debugging.
|
Project - FaceGame_10 and those items
|
|
|
1. |
Create new Visual Basic 2010 project -
FaceGame_10, The steps to create
...
|
Run
Microsoft Visual Studio 2010 Professional. On the
File menu , click New, and then click Project
.... The New Project dialog box appears.
- In the installed
Templates pane, select the Visual Basic
- and then Select
Windows Forms Application icon.
A message appears: Type: Visual Basic.
A project for creating an application with a Windows user
interface.
- In
the Name box, type
FaceGame_10
- In
the Location box, type
C:\
- Click
OK.
The
Windows Application create all
necessary files and opens the Visual Basic 2010 project -
FaceGame_10. System Create Automaticaly Empty Form
- Form1.vb.The codes file, created
...
Public
Class
Form1
Private
Sub
Form1_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
End
Sub
End
Class |
Rename
the created Form -
Form1.vb
- On the
View menu , click
Solution Explorer
- In
Solution Explorer, expand
the FaceGame_10 project node and select
Form1.vb
- In
Properties windows, Type
the new File Name =
FaceGame.vb
| |
2. |
Create Module -
Module1.vb
|
On the Project
menu , click Add New Item ..., The
Add New Project - FaceGame_10 dialog box appears :.In this
Add New Item - FaceGame_10 dialog box:
Select
Module icon.
A message appears: Type: Common Items.
A file for storing groups of functions
In the Name
box, type Module1.vb
Click Add
The
Module1.vb code stores
information about all public variables
used in this application.
The codes ...
Module
Module1
Public
FFaceGameNet
As
New
FaceGame
Public
Sub
Main()
'
Starts this application
FFaceGameNet =
New
FaceGame
Application.Run(FFaceGameNet)
End
Sub
End
Module |
|
|
Set new Startup object - Sub Main
- On the
Project menu ,
click FaceGame_10 Properties
..., the FaceGame_10 Property Pages
dialog box appears
- In the
Startup form combo
box, choose and
select FaceGame
- In the
Icon combo
box, choose and
select
pic\Face.ico
| |
3. |
FaceGame.vb
a. |
After running, the
following designs display by
order
|
b. |
The View
design..
From the Toolbox\windows Form
addthe following controls
One ImageList control, thirty
eight Label controls
, one MainMenu
controls, twele Panel
controls,
tree PictureBox
controls, one ToolBar
controls and four Timer
controls.
The
Functions ...
Arrange boxes using the
mouse
|
c. |
The Codes
...
Note
- random numbers order
:
in Visual Basic 2010, the random number
generator used
1- Rnd()
function - returns a value less than 1, but
greater than or equal to zero.
2- Dim vrnd as
Integer
3- vrnd = Int(9 * Rnd()) + 1
| | |
1. |
DemoForm.vb
This
Form displays when you select the Zoom button
( zoom+ ) from PictureForm.vb
The
Form design.
The View
design.
From
the Toolbox\windows Form addthe
following controls
One
button control, forty six Label
controls, teen Panel
controls, one PictureBox control and two
Panel
controls.
The
Functions
... Show
how this Game work
.
The Codes
...
|
2. |
AboutForm.vb
This
Form displays, when you
select the Toolbar Button About from
FaceGameNet.vb.
This Form includes the
following controls:
Tree PictureBox control, seven
Label controls, one
Button control
and one Timer
control.
Click
the Button Done, the
current Form unload
The Codes ...
Public
Class
AboutForm
Inherits
System.Windows.Forms.Form
Dim IcoNmbr
As
Integer
Private
Sub
AboutForm_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
IcoNmbr = 0
Me.Timer1.Enabled =
True
End
Sub
Private
Sub
btnDone_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
btndone.Click
'
To close the current form
Me.Close()
FFaceGameNet.New_Game()
End
Sub
Private
Sub
Timer1_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles Timer1.Tick
If IcoNmbr = 0
Then
Me.picico.Image =
Me.picicoOrg0.Image()
IcoNmbr = 1
Else
Me.picico.Image =
Me.picicoOrg1.Image()
IcoNmbr = 0
End
If
End
Sub
Private
Sub
AboutForm_Closed(ByVal
sender
As
Object,
ByVal
e As
System.EventArgs)
Handles
MyBase.Closed
FFaceGameNet.New_Game()
End
Sub
End
Class |
| |
|
|