|
|
|
|
|
The Microsoft Visual C# .Net member of
the Microsoft Visual Studio .Net |
|
Face Game VC Net application ..., describe how to use Microsoft
Visual C# .Net to create game application
The Classes
used in this application
System Drawing,
System.Windows.Forms, ImageList, Label,
MainMenu, Panel, PictureBox, Timer, ToolBar.
- Name -
Face Game VC
Net
- Game
Software.
- Developed with
Microsoft Visual C# .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 VC
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 VC Net.vbproj -
(C:\Face Game VC
Net\Face Game VC Net.vbproj) and then click
Open.
- From
Debug menu, choose and click
Start.
|
Project - Face Game VC
Net
and those
items
|
|
|
1. |
Create new Visual C# .Net project -
Face Game VC Net.csproj
|
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 C#
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 VC
Net.
- In the
Location box, type
C:\
- Click
OK.
The Windows Application create all
necessary files and opens the Visual C# .Net
project - Face Game VC
Net.
Rename the
created Form - Form1.cs
- On the
View menu , click Solution
Explorer
- In Solution
Explorer, expand the Face Game VC
Net project node and select
Form1.cs
- In
Properties windows, Type the new File Name =
FaceGameNet.cs
|
Old |
New |
Filename : |
Form1.cs |
FaceGameNet.cs |
|
| |
|
|
2. |
FaceGameNet.vb
a. |
After running, the
following designs display by
order
|
b. |
The View
design..
List of controls added
from the
Toolbox/Windows Form: 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 C#, the random number generator used
Random randomc = new Random();
int crnd;
crnd = randomc.Next(400);
|
|
| | |
1. |
DemoForm.vb
This Form
displays when you select the Zoom button ( zoom+ )
from PictureForm.cs
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.cs
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 Code ...
using
System;
using
System.Drawing;
using
System.Collections;
using
System.ComponentModel;
using
System.Windows.Forms;
namespace
Face_Game_VC_Net
{
///
<summary>
///
Summary description for AboutForm.
///
</summary>
public
class
AboutForm : System.Windows.Forms.Form
{
internal
System.Windows.Forms.PictureBox picicoOrg1;
internal
System.Windows.Forms.PictureBox picicoOrg0;
internal
System.Windows.Forms.PictureBox picico;
internal
System.Windows.Forms.Button btndone;
public
System.Windows.Forms.Label Line1;
internal
System.Windows.Forms.Label Label4;
internal
System.Windows.Forms.Label Label2;
internal
System.Windows.Forms.Label label6;
internal
System.Windows.Forms.Label Label5;
internal
System.Windows.Forms.Label Label7;
internal
System.Windows.Forms.Label Label1;
//Variable
int
IcoNmbr;
internal
System.Windows.Forms.Timer Timer1;
private
System.ComponentModel.IContainer components;
public
AboutForm()
{
//
//
Required for Windows Form Designer support
//
InitializeComponent();
//
//
TODO: Add any constructor code after InitializeComponent
call
//
}
///
<summary>
///
Clean up any resources being used.
///
</summary>
protected
override
void
Dispose( bool
disposing )
{
if(
disposing )
{
if(components
!= null)
{
components.Dispose();
}
}
base.Dispose(
disposing );
}
Windows Form
Designer generated code |
private
void
AboutForm_Load(object
sender, System.EventArgs e)
{
IcoNmbr = 0;
this.Timer1.Enabled
= true;
}
private
void
btndone_Click(object
sender, System.EventArgs e)
{
//
To close the current form
this.Close();
}
private
void
Timer1_Tick(object
sender, System.EventArgs e)
{
if
(IcoNmbr == 0)
{
this.picico.Image
= this.picicoOrg0.Image;
IcoNmbr = 1;
}
else
{
this.picico.Image
= this.picicoOrg1.Image;
IcoNmbr = 0;
}
}
}
} |
| |
|
|