|
|
|
|
|
The Microsoft
Visual Basic .Net member of the Microsoft Visual Studio .Net |
|
Face Game VB Net application ..., describe how to use Microsoft Visual Basic .Net to create game
application
The Classes
used in this application
System.Drawing, System.Resources, ImageList, Label, MainMenu, Panel,
PictureBox, Timer, ToolBar
- Name -
Face Game VB Net
-
Game
Software.
- Developed with
Microsoft Visual Basic .Net.
-
Functions ...
-
Arrange boxes using the mouse
- Demo
Game
|
- Requirements:
Microsoft Visual Studio .Net.
If you want to run it:
- Remove the
read-only attribute of all files in the
folder - C:\Face
Game VB Net
- Run the
Microsoft Visual Studio .Net.
- From
File menu, choose Open,
choose Project ..., the
Open Project dialog box appears,
select the project file Face
Game VB Net.vbproj -
(C:\Face
Game VB Net\Face
Game VB Net.vbproj)
and then click Open.
- From
Debug menu, choose and click
Start.
|
Project - Face Game VB Net and those items
|
|
|
1. |
Create new Visual Basic .Net project -
Face Game VB Net.vbproj
|
Run
Microsoft Visual Studio .Net. On the
File menu , click New, and then click Project
.... The New Project dialog box appears.
- In the Project
Types pane, select the Visual Basic Projects
folder.
- In the Templates
pane, select Windows Application icon (project
type). A message appears indicating the type of project you
are going to create - (A project for creating an application
with a Windows user interface).
- In the Name
box, type
Face Game VB Net.
- In the
Location box, type
C:\
- Click
OK.
The
Windows Application create all necessary files and
opens the Visual Basic .Net project -
Face Game VB Net.
Rename
the created Form - Form1.vb
- On the View
menu , click Solution Explorer
- In Solution
Explorer, expand the
Face Game VB Net project node and select
Form1.vb
- In Properties
windows, Type the new File Name =
FaceGameNet.vb
|
|
2. |
Create Module -
Module1.vb
|
On the
View menu , click Solution
Explorer
In
Solution Explorer, right click the
Face Game VB
Net., select Add on the
shortcut menu to open other shortcut menu,
click Add New Item, the Add New
Item -
Face Game VB
Net. dialog box
appears.
In
the Add New Item -Face
Game VB Net. dialog box:
In the
Categories pane, select Local Project
Items
In the
Templates pane, select Module icon . A
message appears - (A file for storing groups
of functions).
In the
Name box, type
Module1.vb
Click
Open, in the Solution Explorer
display new item - Module1.vb
The Module1.vb
code stores information about all public variables
used in this application.
The codes ...
Module
Module1Public
FFaceGameNet As
New
FaceGameNet
Public
Sub
Main()
' Starts this
application
FFaceGameNet =
New
FaceGameNet
Application.Run(FFaceGameNet)
End
Sub
End
Module |
|
|
Set new Startup object - Sub Main
- On the
Project menu , click Face
Game VB Net Properties
..., the Face
Game VB Net Property Pages
dialog box appears
- In the
Startup object combo box, choose
and select Sub Main
- Click
OK
|
|
3. |
FaceGameNet.vb
a. |
After running, the
following designs display by order
|
b. |
The View design..
From the Toolbox\windows Form add the
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, 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
32- 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 add the
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
Windows
Form Designer generated code |
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 |
|
|
|
|