|
 |
FG-C2019
Game Window Application
developed with Microsoft Visual C# 2019 |
|
 |
|
|
|
|
|
|
|
The Microsoft Visual C# 2019 member of the Microsoft
Visual Studio Community 2019 |
|
FG-C2019 Game Window Application.., describe how to use Microsoft Visual C# 2019 to create game
application
1- |
FG-C2019
Game Executable (exe file) |
|
|
-
Game
Software, used random
number generator
-
Functions: Arrange
boxes using the
mouse. Look Demo
...
-
Executable Game
(exe file), Developed with
Microsoft Visual C# 2019
|
 |
|
|
|
2- |
The Microsoft Visual C# 2019 member of the Microsoft
Visual Studio Community 2019 |
|
|
3- |
How Create
a C# application project. |
|
-
Open Visual Studio 2019.
-
On the start window, choose Create
a new project.
-
On the Create
a new project window, choose the Windows
Forms App (.NET Framework) template for C#.
(If you prefer, you can refine your search to quickly get to the template
you want. For example, enter or type Windows
Forms App in the search box. Next,
choose C# from
the Language list, and then choose Windows from
the Platform list.)
-
In the Configure
your new project window, type or enter HelloWorld in
the Project
name box. Then, choose Create.
-
Visual Studio opens your new project.
-
Create the application
After you select your C# project template and name your file, Visual Studio
opens a form for you. A form is a Windows user interface. We'll create a
"Hello World" application by adding controls to the form, and then we'll
run the application.
-
Note: the Name of the
default Form created - Form1.cs,
Before to Add controls, it is Available to Modify the name and Proprieties
of this Form
-
Add a "Controls" to this form ...
|
|
|
4- |
FG-C2019 Game
Proprieties and
Solution Explorer |
|
-
FG-C2019 Game Proprieties:
- the
Assembly/Project name : FG-C2019
-
Assembly Project Folder: C:\Users\...\source\repos\FG-C2019\
-
the Target framework: .Net Framework 4.7.2
-
the Output
type: Window Application
-
Startup
object: FG-C2019.Program
|
 |
-
FG-C2019 Solution Explorer
-
FG-C2019
project developed with C# 2019, consist of:
- 3
Form files:
FaceGame2019.cs,
Demo.cs,
Aboout.cs
- 1
Folder - pic
pic folder stores 10 picture files
|
|
 |
|
|
|
5- |
How to
Run this application
|
|
-
Remove the read-only attribute
of all files in the folder -
C:\Users\...\source\repos\FG-C2019
-
Run
the Microsoft Visual Studio
Community 2019.
-
From
File menu, choose
Open then
choose Project/Solution,
the Open Project dialog
box appears, select the
FG-C2019 project file -Type:
Microsoft Visual Studio Solution
(C:\Users\...\source\repos\FG-C2019 \FG-C2019 .sln)
and then click Open.
-
From
Debug menu, choose and
click Start Debugging
|
|
|
6- |
After running
FG-C2019,
the following View design display by order |
|
|
 |
FG-C2019 Game Application developed with Microsoft Visual Studio Community 2019, C# - Face Game
|
|
FG-C2019 Game Application
developed with Microsoft Visual
Studio Community 2019, C# - Face
Game |
1. |
-
Game
Software, used random
number generator
-
Functions: Arrange
boxes using the
mouse. Look Demo
...
-
Includes three
Forms
-
Classes
used : System Drawing,
System Windows Forms,
ImageList, Label, MainMenu,
Panel, PictureBox, Timer,
ToolBar
|
2. |
1st Form -
FaceGame2019.cs |
|
The design
|
 |
Functions
|
Arrange boxes
using the mouse |
|
3. |
2nd Form - Demo.cs |
|
The design
|
 |
Functions
|
Animation |
|
4. |
3th Form - Aboout.cs |
|
The design
|
 |
Functions
|
Animation |
|
|
|
|
|
|
|
|
|
|
|
7- |
FaceGame2019.cs,
1st Form of
FG-C2019 project/Application |
|
7.1 |
View Design |
|
 |
|
|
7.2 |
View Codes |
|
|
 |
the Code of FaceGame2019 Form |
|
the Code of FaceGame2019 Form of
FG-C2019 Game Application
developed with Microsoft Visual
Studio Community 2019, C# - Face
Game |
|
|
|
using System;
using
System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FG_C2019
{
public partial class
FaceGame : Form
{
// Variables
System.Windows.Forms.Panel
vobject;
// Graphic
Graphics ex;
DateTime vtime;
DateTime New_Game_BTime;
DateTime New_Game_interval;
bool FaceGametest;
bool Flg_Time;
bool TimerFlag;
bool Welcome_Flag;
bool TheGood_Flag;
short vstate;
int Vcount;
int Initial;
int VlocationX;
int VlocationY;
// Arrays
readonly string[,] A = new
string[10, 5];
readonly string[] G_Box =
new string[10];
readonly bool[] G_Flag = new
bool[10];
readonly int[,] LP = new
int[10, 3];
readonly int[] G1 = new
int[5];
readonly int[] G2 = new
int[5];
readonly int[] G3 = new
int[5];
readonly int[] G4 = new
int[5];
readonly int[] G5 = new
int[5];
readonly int[] G6 = new
int[5];
readonly int[] G7 = new
int[5];
readonly int[] G8 = new
int[5];
readonly int[] G9 = new
int[5];
// Random values
double vrnd0;
double vrnd1;
double vrnd2;
double vrnd3;
double vrnd4;
public FaceGame()
{
InitializeComponent();
}
private void
AboutToolStripMenuItem_Click(object
sender, EventArgs e)
{
Aboout Ab = new Aboout();
Ab.Show();
}
private void
ExitToolStripMenuItem_Click(object
sender, EventArgs e)
{
Application.Exit();
}
private void
DemoToolStripMenuItem_Click(object
sender, EventArgs e)
{
Demo Df = new Demo();
Df.Show();
}
private void
FaceGameToolStripMenuItem_Click(object
sender, EventArgs e)
{
New_Game();
}
private void
FaceGame_Load(object sender,
EventArgs e)
{
Vcount = 0;
// Resize
// LWelcome
this.PWelcome.Height = 290;
this.PWelcome.Width = 290;
this.Lwelcome.Top = (this.PWelcome.Height
- this.Lwelcome.Height) / 2;
this.Lwelcome.Left = (this.PWelcome.Width
- this.Lwelcome.Width) / 2;
// PictureBox1
this.PPicture.Height = 290;
this.PPicture.Width = 290;
this.PictureBox1.Location =
new System.Drawing.Point(0,
0);
this.PictureBox1.Height =
this.PPicture.Height;
this.PictureBox1.Width =
this.PPicture.Width;
this.PPicture1.Height = 290;
this.PPicture1.Width = 290;
this.PictureBox2.Top =
(this.PPicture1.Height -
this.PictureBox2.Height) /
2;
this.PictureBox2.Left =
(this.PPicture1.Width -
this.PictureBox2.Width) / 2;
this.PictureBox3.Top =
(this.PPicture1.Height -
this.PictureBox3.Height) /
2;
this.PictureBox3.Left =
(this.PPicture1.Width -
this.PictureBox3.Width) / 2;
// Initial Position
Initial = 1;
// New Game Load Procedure
New_Game_Sub();
}
// New Game Load Procedure
**********************************
private void New_Game_Sub()
{
object Initial_Flag;
// Random values
vrnd0 = 0.1;
vrnd1 = 0.1;
vrnd2 = 0.1;
vrnd3 = 0.1;
vrnd4 = 0.1;
FaceGametest = true;
WelcomeSub(true);
// Initialisation
Initial_Array();
LOne.Visible = true;
// Initial Position Sub
Initial_Flag = true;
Initial_Position();
// Start Timer Load, New
Game
vtime = System.DateTime.Now;
New_Game_BTime = vtime;
Flg_Time = false;
TimerFlag = true;
Timer1.Enabled = true;
Timer2.Enabled = true;
Timer3.Enabled = true;
Timer4.Enabled = true;
}
//Show the word - Welcome
*************************************
private void WelcomeSub(bool
weloperation)
{
if (weloperation == true)
{
// Graphics
ex =
this.PictureBox1.CreateGraphics();
ex.Clear(SystemColors.Control);
//
Toolbar1.Buttons[1].Enabled
= false;
this.LTImer.Visible = false;
this.LInterval.Visible =
false;
// Welcome
this.Lwelcome.Text = " ";
Vcount = 1;
this.PWelcome.Location = new
System.Drawing.Point(8, 80);
Timer_Welcome.Enabled =
true;
Welcome_Flag = true;
// Circle
this.PPicture.Location = new
System.Drawing.Point(320,
80);
TimerCircle.Enabled = true;
}
else
{
if (weloperation == false)
{
//
Toolbar1.Buttons[1].Enabled
= true;
this.LTImer.Visible = true;
this.LInterval.Text = " ";
this.LInterval.BackColor =
SystemColors.Desktop;
this.LInterval.Visible =
true;
// Welcome
this.PWelcome.Location = new
System.Drawing.Point(8,
464);
Timer_Welcome.Enabled =
false;
Welcome_Flag = false;
// Circle
this.PPicture.Location = new
System.Drawing.Point(264,
464);
TimerCircle.Enabled = false;
}
}
}
private void Initial_Array()
//********************************
{
for (int i1 = 0; i1 <= 9;
i1++)
{
for (int i2 = 0; i2 <= 4;
i2++)
{
A[i1, i2] = "";
}
}
for (int i1 = 0; i1 <= 9;
i1++)
{
G_Flag[i1] = false;
}
for (int i1 = 0; i1 <= 9;
i1++)
{
G_Box[i1] = "";
}
}
//Different positions show
**************************************
private void
Initial_Position()
{
// Initial Position
switch (Initial)
{
case 1:
LP[1, 1] = 512;
LP[1, 2] = 80;
LP[2, 1] = 320;
LP[2, 2] = 176;
LP[3, 1] = 416;
LP[3, 2] = 176;
LP[4, 1] = 512;
LP[4, 2] = 272;
LP[5, 1] = 512;
LP[5, 2] = 176;
LP[6, 1] = 320;
LP[6, 2] = 272;
LP[7, 1] = 416;
LP[7, 2] = 80;
LP[8, 1] = 416;
LP[8, 2] = 272;
LP[9, 1] = 320;
LP[9, 2] = 80;
break;
case 2:
LP[1, 1] = 416;
LP[1, 2] = 80;
LP[2, 1] = 512;
LP[2, 2] = 272;
LP[3, 1] = 320;
LP[3, 2] = 272;
LP[4, 1] = 512;
LP[4, 2] = 176;
LP[5, 1] = 512;
LP[5, 2] = 80;
LP[6, 1] = 416;
LP[6, 2] = 176;
LP[7, 1] = 320;
LP[7, 2] = 80;
LP[8, 1] = 320;
LP[8, 2] = 176;
LP[9, 1] = 416;
LP[9, 2] = 272;
break;
case 3:
LP[1, 1] = 512;
LP[1, 2] = 272;
LP[2, 1] = 416;
LP[2, 2] = 80;
LP[3, 1] = 416;
LP[3, 2] = 176;
LP[4, 1] = 416;
LP[4, 2] = 272;
LP[5, 1] = 320;
LP[5, 2] = 176;
LP[6, 1] = 320;
LP[6, 2] = 272;
LP[7, 1] = 512;
LP[7, 2] = 80;
LP[8, 1] = 320;
LP[8, 2] = 80;
LP[9, 1] = 512;
LP[9, 2] = 176;
break;
case 4:
LP[1, 1] = 512;
LP[1, 2] = 272;
LP[2, 1] = 320;
LP[2, 2] = 272;
LP[3, 1] = 512;
LP[3, 2] = 80;
LP[4, 1] = 416;
LP[4, 2] = 80;
LP[5, 1] = 320;
LP[5, 2] = 80;
LP[6, 1] = 416;
LP[6, 2] = 272;
LP[7, 1] = 416;
LP[7, 2] = 176;
LP[8, 1] = 320;
LP[8, 2] = 176;
LP[9, 1] = 512;
LP[9, 2] = 176;
break;
case 5:
LP[1, 1] = 512;
LP[1, 2] = 176;
LP[2, 1] = 416;
LP[2, 2] = 176;
LP[3, 1] = 512;
LP[3, 2] = 272;
LP[4, 1] = 320;
LP[4, 2] = 176;
LP[5, 1] = 320;
LP[5, 2] = 272;
LP[6, 1] = 320;
LP[6, 2] = 80;
LP[7, 1] = 416;
LP[7, 2] = 80;
LP[8, 1] = 512;
LP[8, 2] = 80;
LP[9, 1] = 416;
LP[9, 2] = 272;
break;
case 6:
LP[1, 1] = 320;
LP[1, 2] = 176;
LP[2, 1] = 320;
LP[2, 2] = 80;
LP[3, 1] = 416;
LP[3, 2] = 176;
LP[4, 1] = 512;
LP[4, 2] = 80;
LP[5, 1] = 512;
LP[5, 2] = 272;
LP[6, 1] = 416;
LP[6, 2] = 272;
LP[7, 1] = 512;
LP[7, 2] = 176;
LP[8, 1] = 320;
LP[8, 2] = 272;
LP[9, 1] = 416;
LP[9, 2] = 80;
break;
case 7:
LP[1, 1] = 320;
LP[1, 2] = 272;
LP[2, 1] = 416;
LP[2, 2] = 272;
LP[3, 1] = 320;
LP[3, 2] = 176;
LP[4, 1] = 416;
LP[4, 2] = 176;
LP[5, 1] = 416;
LP[5, 2] = 80;
LP[6, 1] = 320;
LP[6, 2] = 80;
LP[7, 1] = 512;
LP[7, 2] = 272;
LP[8, 1] = 512;
LP[8, 2] = 176;
LP[9, 1] = 512;
LP[9, 2] = 80;
break;
}
Panel1.SetBounds((LP[1, 1]),
(LP[1, 2]), 96, 96);
Panel2.SetBounds((LP[2, 1]),
(LP[2, 2]), 96, 96);
Panel3.SetBounds((LP[3, 1]),
(LP[3, 2]), 96, 96);
Panel4.SetBounds((LP[4, 1]),
(LP[4, 2]), 96, 96);
Panel5.SetBounds((LP[5, 1]),
(LP[5, 2]), 96, 96);
Panel6.SetBounds((LP[6, 1]),
(LP[6, 2]), 96, 96);
Panel7.SetBounds((LP[7, 1]),
(LP[7, 2]), 96, 96);
Panel8.SetBounds((LP[8, 1]),
(LP[8, 2]), 96, 96);
Panel9.SetBounds((LP[9, 1]),
(LP[9, 2]), 96, 96);
}
private void
Panel1_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel1, e);
Subcursor1(Lb11, Lb12, Lb13,
Lb14);
}
private void
Panel1_MouseClick(object
sender, MouseEventArgs e)
{
Subcursor(Panel1, e);
Subcursor1(Lb11, Lb12, Lb13,
Lb14);
}
private void
Panel2_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel2, e);
Subcursor1(Lb21, Lb22, Lb23,
Lb24);
}
private void
Panel2_MouseClick(object
sender, MouseEventArgs e)
{
Subcursor(Panel2, e);
Subcursor1(Lb21, Lb22, Lb23,
Lb24);
}
private void
Panel3_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel3, e);
Subcursor1(Lb31, Lb32, Lb33,
Lb34);
}
private void
Panel4_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel4, e);
Subcursor1(Lb41, Lb42, Lb43,
Lb44);
}
private void
Panel5_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel5, e);
Subcursor1(Lb51, Lb52, Lb53,
Lb54);
}
private void
Panel6_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel6, e);
Subcursor1(Lb61, Lb62, Lb63,
Lb64);
}
private void
Panel7_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel7, e);
Subcursor1(Lb71, Lb72, Lb73,
Lb74);
}
private void
Panel8_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel8, e);
Subcursor1(Lb81, Lb82, Lb83,
Lb84);
}
private void
Panel9_MouseUp(object
sender, MouseEventArgs e)
{
Subcursor(Panel9, e);
Subcursor1(Lb91, Lb92, Lb93,
Lb94);
}
private void
Subcursor(System.Windows.Forms.Panel
vsender,
System.Windows.Forms.MouseEventArgs
ve)
{
vobject = vsender;
if (ve.Button ==
MouseButtons.Left)
{
vobject.Cursor = Cursors.No;
vstate = 1;
VlocationX =
vobject.Location.X;
VlocationY =
vobject.Location.Y;
}
else
{
if (ve.Button ==
MouseButtons.Right)
{
vstate = 0;
vobject.Cursor =
Cursors.Default;
}
}
}
private void
Subcursor1(System.Windows.Forms.Label
VLb1,
System.Windows.Forms.Label
VLb2,
System.Windows.Forms.Label
VLb3,
System.Windows.Forms.Label
VLb4)
{
VLb1.Cursor = vobject.Cursor;
VLb2.Cursor = vobject.Cursor;
VLb3.Cursor = vobject.Cursor;
VLb4.Cursor = vobject.Cursor;
}
//**************************************
private void
FaceGame_MouseUp(object
sender, MouseEventArgs e)
{
string indexx;
int EX;
int EY;
EX = 0;
EY = 0;
// First Group, X
if (e.X >= 0 && e.X < 104)
EX = 8;
if (e.X >= 104 && e.X < 200)
EX = 104;
if (e.X >= 200 && e.X < 296)
EX = 200;
// Second Group, X
if (e.X >= 296 && e.X < 416)
EX = 320;
if (e.X >= 416 && e.X < 512)
EX = 416;
if (e.X >= 512 && e.X <= (this.Width))
EX = 512;
// Y
if (e.Y >= 0 && e.Y < 176)
EY = 80;
if (e.Y >= 176 && e.Y < 272)
EY = 176;
if (e.Y >= 272 && e.Y < (this.Height))
EY = 272;
indexx =
vobject.Name.Substring((vobject.Name.Length
- 1), 1);
LSelect.Text = " ";
if (vstate == 1)
{
LSelect.Text = " ";
if (EX > 296)
{
if (VlocationX > 296)
{
// Move to
vobject.SetBounds((LP[System.Convert.ToInt16(indexx),
1]),
(LP[System.Convert.ToInt16(indexx),
2]), 96, 96);
SubCondition(indexx);
LSelect.Text = "Operation
not available";
}
else
{
if (VlocationX < 296)
{
// Clear
Verification_Value();
// Move to
vobject.SetBounds((LP[System.Convert.ToInt16(indexx),
1]),
(LP[System.Convert.ToInt16(indexx),
2]), 96, 96);
SubCondition(indexx);
}
}
}
else
{
if (EX < 296)
{
// Move to
vobject.SetBounds((EX), (EY),
96, 96);
// Clear
Verification_Value();
// Store Information
G_Flag[System.Convert.ToInt16(indexx)]
= true;
// Calcul
Calcul_Value(indexx, EX, EY);
// Test
Equal_Value(indexx, EX, EY);
SubCondition(indexx);
}
}
}
}
//****************************************************
private void
Verification_Value()
{
if (VlocationX == 8 &&
VlocationY == 80)
{
A[1, 1] = "";
A[1, 2] = "";
}
else
{
if (VlocationX == 8 &&
VlocationY == 176)
{
A[2, 1] = "";
A[2, 2] = "";
A[2, 3] = "";
}
else
{
if (VlocationX == 8 &&
VlocationY == 272)
{
A[3, 1] = "";
A[3, 2] = "";
}
else
{
if (VlocationX == 104 &&
VlocationY == 80)
{
A[4, 1] = "";
A[4, 2] = "";
A[4, 3] = "";
}
else
{
if (VlocationX == 104 &&
VlocationY == 176)
{
A[5, 1] = "";
A[5, 2] = "";
A[5, 3] = "";
A[5, 4] = "";
}
else
{
if (VlocationX == 104 &&
VlocationY == 272)
{
A[6, 1] = "";
A[6, 2] = "";
A[6, 3] = "";
}
else
{
if (VlocationX == 200 &&
VlocationY == 80)
{
A[7, 1] = "";
A[7, 2] = "";
}
else
{
if (VlocationX == 200 &&
VlocationY == 176)
{
A[8, 1] = "";
A[8, 2] = "";
A[8, 3] = "";
}
else
{
if (VlocationX == 200 &&
VlocationY == 272)
{
A[9, 1] = "";
A[9, 2] = "";
}
}
}
}
}
}
}
}
}
}
//****************************************
private void
SubCondition(string idx)
{
vobject.Cursor =
Cursors.Default;
vstate = 0;
if (idx == "1")
Subcursor1(Lb11, Lb12, Lb13,
Lb14);
else
{
if (idx == "2")
Subcursor1(Lb21, Lb22, Lb23,
Lb24);
else
{
if (idx == "3")
Subcursor1(Lb31, Lb32, Lb33,
Lb34);
else
{
if (idx == "4")
Subcursor1(Lb41, Lb42, Lb43,
Lb44);
else
{
if (idx == "5")
Subcursor1(Lb51, Lb52, Lb53,
Lb54);
else
{
if (idx == "6")
Subcursor1(Lb61, Lb62, Lb63,
Lb64);
else
{
if (idx == "7")
Subcursor1(Lb71, Lb72, Lb73,
Lb74);
else
{
if (idx == "8")
Subcursor1(Lb81, Lb82, Lb83,
Lb84);
else
{
if (idx == "9")
Subcursor1(Lb91, Lb92, Lb93,
Lb94);
}
}
}
}
}
}
}
}
}
private void
Calcul_Value(string indx,
int VarX, int VarY)
{
if
(G_Flag[System.Convert.ToInt16(indx)]
== false)
{
G_Flag[System.Convert.ToInt16(indx)]
= true;
}
if (VarX == 8 && VarY == 80)
{
G_Box[System.Convert.ToInt16(indx)]
= "1";
switch (indx)
{
case "1":
A[1, 1] = Lb13.Text;
A[1, 2] = Lb14.Text;
break;
case "2":
A[1, 1] = Lb23.Text;
A[1, 2] = Lb24.Text;
break;
case "3":
A[1, 1] = Lb33.Text;
A[1, 2] = Lb34.Text;
break;
case "4":
A[1, 1] = Lb43.Text;
A[1, 2] = Lb44.Text;
break;
case "5":
A[1, 1] = Lb53.Text;
A[1, 2] = Lb54.Text;
break;
case "6":
A[1, 1] = Lb63.Text;
A[1, 2] = Lb64.Text;
break;
case "7":
A[1, 1] = Lb73.Text;
A[1, 2] = Lb74.Text;
break;
case "8":
A[1, 1] = Lb83.Text;
A[1, 2] = Lb84.Text;
break;
case "9":
A[1, 1] = Lb93.Text;
A[1, 2] = Lb94.Text;
break;
}
}
else
{
if (VarX == 8 && VarY ==
176)
{
G_Box[System.Convert.ToInt16(indx)]
= "2";
switch (indx)
{
case "1":
A[2, 1] = Lb11.Text;
A[2, 2] = Lb13.Text;
A[2, 3] = Lb14.Text;
break;
case "2":
A[2, 1] = Lb21.Text;
A[2, 2] = Lb23.Text;
A[2, 3] = Lb24.Text;
break;
case "3":
A[2, 1] = Lb31.Text;
A[2, 2] = Lb33.Text;
A[2, 3] = Lb34.Text;
break;
case "4":
A[2, 1] = Lb41.Text;
A[2, 2] = Lb43.Text;
A[2, 3] = Lb44.Text;
break;
case "5":
A[2, 1] = Lb51.Text;
A[2, 2] = Lb53.Text;
A[2, 3] = Lb54.Text;
break;
case "6":
A[2, 1] = Lb61.Text;
A[2, 2] = Lb63.Text;
A[2, 3] = Lb64.Text;
break;
case "7":
A[2, 1] = Lb71.Text;
A[2, 2] = Lb73.Text;
A[2, 3] = Lb74.Text;
break;
case "8":
A[2, 1] = Lb81.Text;
A[2, 2] = Lb83.Text;
A[2, 3] = Lb84.Text;
break;
case "9":
A[2, 1] = Lb91.Text;
A[2, 2] = Lb93.Text;
A[2, 3] = Lb94.Text;
break;
}
}
else
{
if (VarX == 8 && VarY ==
272)
{
G_Box[System.Convert.ToInt16(indx)]
= "3";
switch (indx)
{
case "1":
A[3, 1] = Lb11.Text;
A[3, 2] = Lb14.Text;
break;
case "2":
A[3, 1] = Lb21.Text;
A[3, 2] = Lb24.Text;
break;
case "3":
A[3, 1] = Lb31.Text;
A[3, 2] = Lb34.Text;
break;
case "4":
A[3, 1] = Lb41.Text;
A[3, 2] = Lb44.Text;
break;
case "5":
A[3, 1] = Lb51.Text;
A[3, 2] = Lb54.Text;
break;
case "6":
A[3, 1] = Lb61.Text;
A[3, 2] = Lb64.Text;
break;
case "7":
A[3, 1] = Lb71.Text;
A[3, 2] = Lb74.Text;
break;
case "8":
A[3, 1] = Lb81.Text;
A[3, 2] = Lb84.Text;
break;
case "9":
A[3, 1] = Lb91.Text;
A[3, 2] = Lb94.Text;
break;
}
}
else
{
if (VarX == 104 && VarY ==
80)
{
G_Box[System.Convert.ToInt16(indx)]
= "4";
switch (indx)
{
case "1":
A[4, 1] = Lb12.Text;
A[4, 2] = Lb13.Text;
A[4, 3] = Lb14.Text;
break;
case "2":
A[4, 1] = Lb22.Text;
A[4, 2] = Lb23.Text;
A[4, 3] = Lb24.Text;
break;
case "3":
A[4, 1] = Lb32.Text;
A[4, 2] = Lb33.Text;
A[4, 3] = Lb34.Text;
break;
case "4":
A[4, 1] = Lb42.Text;
A[4, 2] = Lb43.Text;
A[4, 3] = Lb44.Text;
break;
case "5":
A[4, 1] = Lb52.Text;
A[4, 2] = Lb53.Text;
A[4, 3] = Lb54.Text;
break;
case "6":
A[4, 1] = Lb62.Text;
A[4, 2] = Lb63.Text;
A[4, 3] = Lb64.Text;
break;
case "7":
A[4, 1] = Lb72.Text;
A[4, 2] = Lb73.Text;
A[4, 3] = Lb74.Text;
break;
case "8":
A[4, 1] = Lb82.Text;
A[4, 2] = Lb83.Text;
A[4, 3] = Lb84.Text;
break;
case "9":
A[4, 1] = Lb92.Text;
A[4, 2] = Lb93.Text;
A[4, 3] = Lb94.Text;
break;
}
}
else
{
if (VarX == 104 && VarY ==
176)
{
G_Box[System.Convert.ToInt16(indx)]
= "5";
switch (indx)
{
case "1":
A[5, 1] = Lb11.Text;
A[5, 2] = Lb12.Text;
A[5, 3] = Lb13.Text;
A[5, 4] = Lb14.Text;
break;
case "2":
A[5, 1] = Lb21.Text;
A[5, 2] = Lb22.Text;
A[5, 3] = Lb23.Text;
A[5, 4] = Lb24.Text;
break;
case "3":
A[5, 1] = Lb31.Text;
A[5, 2] = Lb32.Text;
A[5, 3] = Lb33.Text;
A[5, 4] = Lb34.Text;
break;
case "4":
A[5, 1] = Lb41.Text;
A[5, 2] = Lb42.Text;
A[5, 3] = Lb43.Text;
A[5, 4] = Lb44.Text;
break;
case "5":
A[5, 1] = Lb51.Text;
A[5, 2] = Lb52.Text;
A[5, 3] = Lb53.Text;
A[5, 4] = Lb54.Text;
break;
case "6":
A[5, 1] = Lb61.Text;
A[5, 2] = Lb62.Text;
A[5, 3] = Lb63.Text;
A[5, 4] = Lb64.Text;
break;
case "7":
A[5, 1] = Lb71.Text;
A[5, 2] = Lb72.Text;
A[5, 3] = Lb73.Text;
A[5, 4] = Lb74.Text;
break;
case "8":
A[5, 1] = Lb81.Text;
A[5, 2] = Lb82.Text;
A[5, 3] = Lb83.Text;
A[5, 4] = Lb84.Text;
break;
case "9":
A[5, 1] = Lb91.Text;
A[5, 2] = Lb92.Text;
A[5, 3] = Lb93.Text;
A[5, 4] = Lb94.Text;
break;
}
}
else
{
if (VarX == 104 && VarY ==
272)
{
G_Box[System.Convert.ToInt16(indx)]
= "6";
switch (indx)
{
case "1":
A[6, 1] = Lb11.Text;
A[6, 2] = Lb12.Text;
A[6, 3] = Lb14.Text;
break;
case "2":
A[6, 1] = Lb21.Text;
A[6, 2] = Lb22.Text;
A[6, 3] = Lb24.Text;
break;
case "3":
A[6, 1] = Lb31.Text;
A[6, 2] = Lb32.Text;
A[6, 3] = Lb34.Text;
break;
case "4":
A[6, 1] = Lb41.Text;
A[6, 2] = Lb42.Text;
A[6, 3] = Lb44.Text;
break;
case "5":
A[6, 1] = Lb51.Text;
A[6, 2] = Lb52.Text;
A[6, 3] = Lb54.Text;
break;
case "6":
A[6, 1] = Lb61.Text;
A[6, 2] = Lb62.Text;
A[6, 3] = Lb64.Text;
break;
case "7":
A[6, 1] = Lb71.Text;
A[6, 2] = Lb72.Text;
A[6, 3] = Lb74.Text;
break;
case "8":
A[6, 1] = Lb81.Text;
A[6, 2] = Lb82.Text;
A[6, 3] = Lb84.Text;
break;
case "9":
A[6, 1] = Lb91.Text;
A[6, 2] = Lb92.Text;
A[6, 3] = Lb94.Text;
break;
}
}
else
{
if (VarX == 200 && VarY ==
80)
{
G_Box[System.Convert.ToInt16(indx)]
= "7";
switch (indx)
{
case "1":
A[7, 1] = Lb12.Text;
A[7, 2] = Lb13.Text;
break;
case "2":
A[7, 1] = Lb22.Text;
A[7, 2] = Lb23.Text;
break;
case "3":
A[7, 1] = Lb32.Text;
A[7, 2] = Lb33.Text;
break;
case "4":
A[7, 1] = Lb42.Text;
A[7, 2] = Lb43.Text;
break;
case "5":
A[7, 1] = Lb52.Text;
A[7, 2] = Lb53.Text;
break;
case "6":
A[7, 1] = Lb62.Text;
A[7, 2] = Lb63.Text;
break;
case "7":
A[7, 1] = Lb72.Text;
A[7, 2] = Lb73.Text;
break;
case "8":
A[7, 1] = Lb82.Text;
A[7, 2] = Lb83.Text;
break;
case "9":
A[7, 1] = Lb92.Text;
A[7, 2] = Lb93.Text;
break;
}
}
else
{
if (VarX == 200 && VarY ==
176)
{
G_Box[System.Convert.ToInt16(indx)]
= "8";
switch (indx)
{
case "1":
A[8, 1] = Lb11.Text;
A[8, 2] = Lb12.Text;
A[8, 3] = Lb13.Text;
break;
case "2":
A[8, 1] = Lb21.Text;
A[8, 2] = Lb22.Text;
A[8, 3] = Lb23.Text;
break;
case "3":
A[8, 1] = Lb31.Text;
A[8, 2] = Lb32.Text;
A[8, 3] = Lb33.Text;
break;
case "4":
A[8, 1] = Lb41.Text;
A[8, 2] = Lb42.Text;
A[8, 3] = Lb43.Text;
break;
case "5":
A[8, 1] = Lb51.Text;
A[8, 2] = Lb52.Text;
A[8, 3] = Lb53.Text;
break;
case "6":
A[8, 1] = Lb61.Text;
A[8, 2] = Lb62.Text;
A[8, 3] = Lb63.Text;
break;
case "7":
A[8, 1] = Lb71.Text;
A[8, 2] = Lb72.Text;
A[8, 3] = Lb73.Text;
break;
case "8":
A[8, 1] = Lb81.Text;
A[8, 2] = Lb82.Text;
A[8, 3] = Lb83.Text;
break;
case "9":
A[8, 1] = Lb91.Text;
A[8, 2] = Lb92.Text;
A[8, 3] = Lb93.Text;
break;
}
}
else
{
if (VarX == 200 && VarY ==
272)
{
G_Box[System.Convert.ToInt16(indx)]
= "9";
switch (indx)
{
case "1":
A[9, 1] = Lb11.Text;
A[9, 2] = Lb12.Text;
break;
case "2":
A[9, 1] = Lb21.Text;
A[9, 2] = Lb22.Text;
break;
case "3":
A[9, 1] = Lb31.Text;
A[9, 2] = Lb32.Text;
break;
case "4":
A[9, 1] = Lb41.Text;
A[9, 2] = Lb42.Text;
break;
case "5":
A[9, 1] = Lb51.Text;
A[9, 2] = Lb52.Text;
break;
case "6":
A[9, 1] = Lb61.Text;
A[9, 2] = Lb62.Text;
break;
case "7":
A[9, 1] = Lb71.Text;
A[9, 2] = Lb72.Text;
break;
case "8":
A[9, 1] = Lb81.Text;
A[9, 2] = Lb82.Text;
break;
case "9":
A[9, 1] = Lb91.Text;
A[9, 2] = Lb92.Text;
break;
}
}
}
}
}
}
}
}
}
}
}
//Test, Equal Values
private void
Equal_Value(string indx, int
VarX, int VarY)
{
if (VarX == 8 && VarY == 80)
{
if (A[2, 1] != "")
{
if (A[1, 1] != A[2, 1])
{
A[1, 1] = "";
A[1, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[4, 1] != "")
{
if (A[1, 2] != A[4, 1])
{
A[1, 1] = "";
A[1, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 8 && VarY ==
176)
{
if (A[1, 1] != "")
{
if (A[2, 1] != A[1, 1])
{
A[2, 1] = "";
A[2, 2] = "";
A[2, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[3, 1] != "")
{
if (A[2, 2] != A[3, 1])
{
A[2, 1] = "";
A[2, 2] = "";
A[2, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[5, 2] != "")
{
if (A[2, 3] != A[5, 2])
{
A[2, 1] = "";
A[2, 2] = "";
A[2, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 8 && VarY ==
272)
{
if (A[2, 2] != "")
{
if (A[3, 1] != A[2, 2])
{
A[3, 1] = "";
A[3, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[6, 2] != "")
{
if (A[3, 2] != A[6, 2])
{
A[3, 1] = "";
A[3, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 104 && VarY ==
80)
{
if (A[1, 2] != "")
{
if (A[4, 1] != A[1, 2])
{
A[4, 1] = "";
A[4, 2] = "";
A[4, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[5, 1] != "")
{
if (A[4, 2] != A[5, 1])
{
A[4, 1] = "";
A[4, 2] = "";
A[4, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[7, 1] != "")
{
if (A[4, 3] != A[7, 1])
{
A[4, 1] = "";
A[4, 2] = "";
A[4, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 104 && VarY ==
176)
{
if (A[4, 2] != "")
{
if (A[5, 1] != A[4, 2])
{
A[5, 1] = "";
A[5, 2] = "";
A[5, 3] = "";
A[5, 4] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[2, 3] != "")
{
if (A[5, 2] != A[2, 3])
{
A[5, 1] = "";
A[5, 2] = "";
A[5, 3] = "";
A[5, 4] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[6, 1] != "")
{
if (A[5, 3] != A[6, 1])
{
A[5, 1] = "";
A[5, 2] = "";
A[5, 3] = "";
A[5, 4] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[8, 2] != "")
{
if (A[5, 4] != A[8, 2])
{
A[5, 1] = "";
A[5, 2] = "";
A[5, 3] = "";
A[5, 4] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 104 && VarY ==
272)
{
if (A[5, 3] != "")
{
if (A[6, 1] != A[5, 3])
{
A[6, 1] = "";
A[6, 2] = "";
A[6, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[3, 2] != "")
{
if (A[6, 2] != A[3, 2])
{
A[6, 1] = "";
A[6, 2] = "";
A[6, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[9, 2] != "")
{
if (A[6, 3] != A[9, 2])
{
A[6, 1] = "";
A[6, 2] = "";
A[6, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 200 && VarY ==
80)
{
if (A[4, 3] != "")
{
if (A[7, 1] != A[4, 3])
{
A[7, 1] = "";
A[7, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[8, 1] != "")
{
if (A[7, 2] != A[8, 1])
{
A[7, 1] = "";
A[7, 2] = "";
//Resultat, Equal Values //Resultat,
Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 200 && VarY ==
176)
{
if (A[7, 2] != "")
{
if (A[8, 1] != A[7, 2])
{
A[8, 1] = "";
A[8, 2] = "";
A[8, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[5, 4] != "")
{
if (A[8, 2] != A[5, 4])
{
A[8, 1] = "";
A[8, 2] = "";
A[8, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[9, 1] != "")
{
if (A[8, 3] != A[9, 1])
{
A[8, 1] = "";
A[8, 2] = "";
A[8, 3] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
else
{
if (VarX == 200 && VarY ==
272)
{
if (A[8, 3] != "")
{
if (A[9, 1] != A[8, 3])
{
A[9, 1] = "";
A[9, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
if (A[6, 3] != "")
{
if (A[9, 2] != A[6, 3])
{
A[9, 1] = "";
A[9, 2] = "";
//Resultat, Equal Values
Pt_Equal(indx);
}
}
}
}
}
}
}
}
}
}
}
}
//Resultat, Equal Values
private void Pt_Equal(string
Vindx)
{
SubCondition(Vindx);
// Move to
vobject.SetBounds((LP[System.Convert.ToInt16(Vindx),
1]),
(LP[System.Convert.ToInt16(Vindx),
2]), 96, 96);
LSelect.Text = "Equal,
operation is aborted";
}
//-----------------------------labels--------------------------
private void
Lb11_MouseUp(object sender,
MouseEventArgs e)
{
}
private void
Lb12_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel1_MouseUp(sender,
e);
}
// private void
Lb13_Click(object sender,
EventArgs e)
private void
Lb13_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel1_MouseUp(sender,
e);
}
private void
Lb14_MouseUp_1(object
sender, MouseEventArgs e)
{
this.Panel1_MouseUp(sender,
e);
}
private void
Lb21_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel2_MouseUp(sender,
e);
}
private void
Lb22_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel2_MouseUp(sender,
e);
}
private void
Lb23_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel2_MouseUp(sender,
e);
}
private void
Lb24_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel2_MouseUp(sender,
e);
}
private void
Lb31_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel3_MouseUp(sender,
e);
}
private void
Lb32_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel3_MouseUp(sender,
e);
}
private void
Lb33_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel3_MouseUp(sender,
e);
}
private void
Lb34_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel3_MouseUp(sender,
e);
}
private void
Lb41_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel4_MouseUp(sender,
e);
}
private void
Lb42_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel4_MouseUp(sender,
e);
}
private void
Lb43_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel4_MouseUp(sender,
e);
}
private void
Lb44_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel4_MouseUp(sender,
e);
}
private void
Lb51_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel5_MouseUp(sender,
e);
}
private void
Lb52_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel5_MouseUp(sender,
e);
}
private void
Lb53_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel5_MouseUp(sender,
e);
}
private void
Lb54_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel5_MouseUp(sender,
e);
}
private void
Lb61_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel6_MouseUp(sender,
e);
}
private void
Lb62_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel6_MouseUp(sender,
e);
}
private void
Lb63_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel6_MouseUp(sender,
e);
}
private void
Lb64_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel6_MouseUp(sender,
e);
}
private void
Lb71_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel7_MouseUp(sender,
e);
}
private void
Lb72_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel7_MouseUp(sender,
e);
}
private void
Lb73_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel7_MouseUp(sender,
e);
}
private void
Lb74_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel7_MouseUp(sender,
e);
}
private void
Lb81_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel8_MouseUp(sender,
e);
}
private void
Lb82_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel8_MouseUp(sender,
e);
}
private void
Lb83_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel8_MouseUp(sender,
e);
}
private void
Lb84_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel8_MouseUp(sender,
e);
}
private void
Lb91_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel9_MouseUp(sender,
e);
}
private void
Lb92_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel9_MouseUp(sender,
e);
}
private void
Lb93_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel9_MouseUp(sender,
e);
}
private void
Lb94_MouseUp(object sender,
MouseEventArgs e)
{
this.Panel9_MouseUp(sender,
e);
}
private void
Timer2_Tick(object sender,
EventArgs e)
{
// Random values
Random randomc71 = new
Random();
Random randomc72 = new
Random();
Random randomc73 = new
Random();
Random randomc74 = new
Random();
Random randomc91 = new
Random();
Random randomc92 = new
Random();
Random randomc93 = new
Random();
Random randomc94 = new
Random();
int crnd71, crnd72, crnd73,
crnd74;
int crnd91, crnd92, crnd93,
crnd94;
if (TimerFlag)
{
// Panel7, G7[] array
crnd71 =
randomc71.Next(100);
if
(System.Convert.ToInt16(crnd71
/ 9) > 0 &&
System.Convert.ToInt16(crnd71
/ 9) < 10)
G7[1] =
System.Convert.ToInt16(crnd71
/ 9);
crnd72 =
randomc72.Next(200);
if
(System.Convert.ToInt16(crnd72
/ 9) > 0 &&
System.Convert.ToInt16(crnd72
/ 9) < 10)
G7[2] =
System.Convert.ToInt16(crnd72
/ 9);
crnd73 =
randomc73.Next(400);
if
(System.Convert.ToInt16(crnd73
/ 9) > 0 &&
System.Convert.ToInt16(crnd73
/ 9) < 10)
G7[3] =
System.Convert.ToInt16(crnd73
/ 9);
crnd74 =
randomc74.Next(300);
if
(System.Convert.ToInt16(crnd74
/ 9) > 0 &&
System.Convert.ToInt16(crnd74
/ 9) < 10)
G7[4] =
System.Convert.ToInt16(crnd74
/ 9);
Lb71.Text = G7[1].ToString();
Lb72.Text = G7[2].ToString();
Lb73.Text = G7[3].ToString();
Lb74.Text = G7[4].ToString();
// Panel9, G9[] array
crnd91 =
randomc91.Next(500);
if
(System.Convert.ToInt16(crnd91
/ 9) > 0 &&
System.Convert.ToInt16(crnd91
/ 9) < 10)
G9[1] =
System.Convert.ToInt16(crnd91
/ 9);
crnd92 =
randomc92.Next(200);
if
(System.Convert.ToInt16(crnd92
/ 9) > 0 &&
System.Convert.ToInt16(crnd92
/ 9) < 10)
G9[2] =
System.Convert.ToInt16(crnd92
/ 9);
crnd93 =
randomc93.Next(400);
if
(System.Convert.ToInt16(crnd93
/ 9) > 0 &&
System.Convert.ToInt16(crnd93
/ 9) < 10)
G9[3] =
System.Convert.ToInt16(crnd93
/ 9);
crnd94 =
randomc94.Next(300);
if
(System.Convert.ToInt16(crnd94
/ 9) > 0 &&
System.Convert.ToInt16(crnd94
/ 9) < 10)
G9[4] =
System.Convert.ToInt16(crnd94
/ 9);
Lb91.Text = G9[1].ToString();
Lb92.Text = G9[2].ToString();
Lb93.Text = G9[3].ToString();
Lb94.Text = G9[4].ToString();
}
}
private void
Timer3_Tick(object sender,
EventArgs e)
{
// Random values
Random randomc21 = new
Random();
Random randomc22 = new
Random();
Random randomc23 = new
Random();
Random randomc24 = new
Random();
Random randomc41 = new
Random();
Random randomc42 = new
Random();
Random randomc43 = new
Random();
Random randomc44 = new
Random();
int crnd21, crnd22, crnd23,
crnd24;
int crnd41, crnd42, crnd43,
crnd44;
if (TimerFlag)
{
// Panel2, G2[] array
crnd21 =
randomc21.Next(200);
if
(System.Convert.ToInt16(crnd21
/ 9) > 0 &&
System.Convert.ToInt16(crnd21
/ 9) < 10)
G2[1] =
System.Convert.ToInt16(crnd21
/ 9);
crnd22 =
randomc22.Next(300);
if
(System.Convert.ToInt16(crnd22
/ 9) > 0 &&
System.Convert.ToInt16(crnd22
/ 9) < 10)
G2[2] =
System.Convert.ToInt16(crnd22
/ 9);
crnd23 =
randomc23.Next(400);
if
(System.Convert.ToInt16(crnd23
/ 9) > 0 &&
System.Convert.ToInt16(crnd23
/ 9) < 10)
G2[3] =
System.Convert.ToInt16(crnd23
/ 9);
crnd24 =
randomc24.Next(500);
if
(System.Convert.ToInt16(crnd24
/ 9) > 0 &&
System.Convert.ToInt16(crnd24
/ 9) < 10)
G2[4] =
System.Convert.ToInt16(crnd24
/ 9);
Lb21.Text = G2[1].ToString();
Lb22.Text = G2[2].ToString();
Lb23.Text = G2[3].ToString();
Lb24.Text = G2[4].ToString();
// Panel4, G4[] array
crnd41 =
randomc41.Next(300);
if
(System.Convert.ToInt16(crnd41
/ 9) > 0 &&
System.Convert.ToInt16(crnd41
/ 9) < 10)
G4[1] =
System.Convert.ToInt16(crnd41
/ 9);
crnd42 =
randomc42.Next(400);
if
(System.Convert.ToInt16(crnd42
/ 9) > 0 &&
System.Convert.ToInt16(crnd42
/ 9) < 10)
G4[2] =
System.Convert.ToInt16(crnd42
/ 9);
crnd43 =
randomc43.Next(500);
if
(System.Convert.ToInt16(crnd43
/ 9) > 0 &&
System.Convert.ToInt16(crnd43
/ 9) < 10)
G4[3] =
System.Convert.ToInt16(crnd43
/ 9);
crnd44 =
randomc44.Next(100);
if
(System.Convert.ToInt16(crnd44
/ 9) > 0 &&
System.Convert.ToInt16(crnd44
/ 9) < 10)
G4[4] =
System.Convert.ToInt16(crnd44
/ 9);
Lb41.Text = G4[1].ToString();
Lb42.Text = G4[2].ToString();
Lb43.Text = G4[3].ToString();
Lb44.Text = G4[4].ToString();
}
}
private void
Timer4_Tick(object sender,
System.EventArgs e)
{
// Random values
Random randomc61 = new
Random();
Random randomc62 = new
Random();
Random randomc63 = new
Random();
Random randomc64 = new
Random();
Random randomc81 = new
Random();
Random randomc82 = new
Random();
Random randomc83 = new
Random();
Random randomc84 = new
Random();
int crnd61, crnd62, crnd63,
crnd64;
int crnd81, crnd82, crnd83,
crnd84;
if (TimerFlag)
{
// Panel6, G6[] array
crnd61 =
randomc61.Next(200);
if
(System.Convert.ToInt16(crnd61
/ 9) > 0 &&
System.Convert.ToInt16(crnd61
/ 9) < 10)
G6[1] =
System.Convert.ToInt16(crnd61
/ 9);
crnd62 =
randomc62.Next(400);
if
(System.Convert.ToInt16(crnd62
/ 9) > 0 &&
System.Convert.ToInt16(crnd62
/ 9) < 10)
G6[2] =
System.Convert.ToInt16(crnd62
/ 9);
crnd63 =
randomc63.Next(100);
if
(System.Convert.ToInt16(crnd63
/ 9) > 0 &&
System.Convert.ToInt16(crnd63
/ 9) < 10)
G6[3] =
System.Convert.ToInt16(crnd63
/ 9);
crnd64 =
randomc64.Next(300);
if
(System.Convert.ToInt16(crnd64
/ 9) > 0 &&
System.Convert.ToInt16(crnd64
/ 9) < 10)
G6[4] =
System.Convert.ToInt16(crnd64
/ 9);
Lb61.Text = G6[1].ToString();
Lb62.Text = G6[2].ToString();
Lb63.Text = G6[3].ToString();
Lb64.Text = G6[4].ToString();
// Panel8, G8[] array
crnd81 =
randomc81.Next(400);
if
(System.Convert.ToInt16(crnd81
/ 9) > 0 &&
System.Convert.ToInt16(crnd81
/ 9) < 10)
G8[1] =
System.Convert.ToInt16(crnd81
/ 9);
crnd82 =
randomc82.Next(500);
if
(System.Convert.ToInt16(crnd82
/ 9) > 0 &&
System.Convert.ToInt16(crnd82
/ 9) < 10)
G8[2] =
System.Convert.ToInt16(crnd82
/ 9);
crnd83 =
randomc83.Next(300);
if
(System.Convert.ToInt16(crnd83
/ 9) > 0 &&
System.Convert.ToInt16(crnd83
/ 9) < 10)
G8[3] =
System.Convert.ToInt16(crnd83
/ 9);
crnd84 =
randomc84.Next(200);
if
(System.Convert.ToInt16(crnd84
/ 9) > 0 &&
System.Convert.ToInt16(crnd84
/ 9) < 10)
G8[4] =
System.Convert.ToInt16(crnd84
/ 9);
Lb81.Text = G8[1].ToString();
Lb82.Text = G8[2].ToString();
Lb83.Text = G8[3].ToString();
Lb84.Text = G8[4].ToString();
}
}
private void
Timer1_Tick(object sender,
EventArgs e)
{
// Random values
Random randomc11 = new
Random();
Random randomc12 = new
Random();
Random randomc13 = new
Random();
Random randomc14 = new
Random();
Random randomc31 = new
Random();
Random randomc32 = new
Random();
Random randomc33 = new
Random();
Random randomc34 = new
Random();
Random randomc51 = new
Random();
Random randomc52 = new
Random();
Random randomc53 = new
Random();
Random randomc54 = new
Random();
int crnd11, crnd12, crnd13,
crnd14;
int crnd31, crnd32, crnd33,
crnd34;
int crnd51, crnd52, crnd53,
crnd54;
if (TimerFlag)
{
// Panel1, G1[] array
crnd11 =
randomc11.Next(100);
if
(System.Convert.ToInt16(crnd11
/ 9) > 0 &&
System.Convert.ToInt16(crnd11
/ 9) < 10)
G1[1] =
System.Convert.ToInt16(crnd11
/ 9);
crnd12 =
randomc12.Next(200);
if
(System.Convert.ToInt16(crnd12
/ 9) > 0 &&
System.Convert.ToInt16(crnd12
/ 9) < 10)
G1[2] =
System.Convert.ToInt16(crnd12
/ 9);
crnd13 =
randomc13.Next(300);
if
(System.Convert.ToInt16(crnd13
/ 9) > 0 &&
System.Convert.ToInt16(crnd13
/ 9) < 10)
G1[3] =
System.Convert.ToInt16(crnd13
/ 9);
crnd14 =
randomc14.Next(400);
if
(System.Convert.ToInt16(crnd14
/ 9) > 0 &&
System.Convert.ToInt16(crnd14
/ 9) < 10)
G1[4] =
System.Convert.ToInt16(crnd14
/ 9);
Lb11.Text = G1[1].ToString();
Lb12.Text = G1[2].ToString();
Lb13.Text = G1[3].ToString();
Lb14.Text = G1[4].ToString();
// Panel3, G3[] array
crnd31 =
randomc31.Next(500);
if
(System.Convert.ToInt16(crnd31
/ 9) > 0 &&
System.Convert.ToInt16(crnd31
/ 9) < 10)
G3[1] =
System.Convert.ToInt16(crnd31
/ 9);
crnd32 =
randomc32.Next(200);
if
(System.Convert.ToInt16(crnd32
/ 9) > 0 &&
System.Convert.ToInt16(crnd32
/ 9) < 10)
G3[2] =
System.Convert.ToInt16(crnd32
/ 9);
crnd33 =
randomc33.Next(300);
if
(System.Convert.ToInt16(crnd33
/ 9) > 0 &&
System.Convert.ToInt16(crnd33
/ 9) < 10)
G3[3] =
System.Convert.ToInt16(crnd33
/ 9);
crnd34 =
randomc34.Next(400);
if
(System.Convert.ToInt16(crnd34
/ 9) > 0 &&
System.Convert.ToInt16(crnd34
/ 9) < 10)
G3[4] =
System.Convert.ToInt16(crnd34
/ 9);
Lb31.Text = G3[1].ToString();
Lb32.Text = G3[2].ToString();
Lb33.Text = G3[3].ToString();
Lb34.Text = G3[4].ToString();
// Panel5, G5[] array
crnd51 =
randomc51.Next(400);
if
(System.Convert.ToInt16(crnd51
/ 9) > 0 &&
System.Convert.ToInt16(crnd51
/ 9) < 10)
G5[1] =
System.Convert.ToInt16(crnd51
/ 9);
crnd52 =
randomc52.Next(300);
if
(System.Convert.ToInt16(crnd52
/ 9) > 0 &&
System.Convert.ToInt16(crnd52
/ 9) < 10)
G5[2] =
System.Convert.ToInt16(crnd52
/ 9);
crnd53 =
randomc53.Next(200);
if
(System.Convert.ToInt16(crnd53
/ 9) > 0 &&
System.Convert.ToInt16(crnd53
/ 9) < 10)
G5[3] =
System.Convert.ToInt16(crnd53
/ 9);
crnd54 =
randomc54.Next(100);
if
(System.Convert.ToInt16(crnd54
/ 9) > 0 &&
System.Convert.ToInt16(crnd54
/ 9) < 10)
G5[4] =
System.Convert.ToInt16(crnd54
/ 9);
Lb51.Text = G5[1].ToString();
Lb52.Text = G5[2].ToString();
Lb53.Text = G5[3].ToString();
Lb54.Text = G5[4].ToString();
}
}
private void
Timer_clock_Tick(object
sender, EventArgs e)
{
// Clock
vtime = System.DateTime.Now;
this.ltime1.Text =
System.DateTime.Now.ToLongTimeString();
// Timer Interval
int vinterval_game;
vinterval_game = ((vtime.Hour
* 60 * 60) + (vtime.Minute *
60) + vtime.Second) - ((New_Game_interval.Hour
* 60 * 60) + (New_Game_interval.Minute
* 60) +
New_Game_interval.Second);
if (Flg_Time)
LInterval.Text =
vinterval_game.ToString() +
" Sec";
// Stop The Load
if (TimerFlag)
{
int vinterval_load;
vinterval_load = ((vtime.Hour
* 60 * 60) + (vtime.Minute *
60) + vtime.Second) - ((New_Game_BTime.Hour
* 60 * 60) + (New_Game_BTime.Minute
* 60) +
New_Game_BTime.Second);
if (vinterval_load > 4)
Stop_Load();
}
if (FaceGametest)
FaceGame_test();
}
//
**********************************************
private void GoodSub(bool
good_Operation)
{
if (good_Operation == true)
{
FaceGametest = false;
this.Lwelcome.Text = " ";
Vcount = 1;
Timer_Welcome.Enabled =
true;
this.PWelcome.Location = new
System.Drawing.Point(8, 80);
this.PPicture1.Location =
new
System.Drawing.Point(320,
80);
this.PictureBox2.Visible =
false;
this.PictureBox3.Visible =
false;
Welcome_Flag = false;
TheGood_Flag = true;
}
else
{
this.LTImer.Visible = false;
this.LInterval.Visible =
false;
Timer_Welcome.Enabled =
false;
this.PWelcome.Location = new
System.Drawing.Point(8,
464);
this.PPicture1.Location =
new
System.Drawing.Point(504,
464);
Welcome_Flag = false;
TheGood_Flag = false;
}
}
/** private void
Toolbar1_ButtonClick(object
sender,
System.Windows.Forms.ToolbarButtonClickEventArgs
e)
{
switch (e.Button.ImageIndex)
{
case 0:
New_Game();
break;
case 1:
Demo Df = new Demo();
Df.Show();
break;
case 2:
Aboout f1 = new Aboout();
f1.Show();
break;
case 3:
Application.Exit();
break;
}
}
**/
// Load New Game
*************************************************
public void New_Game()
{
this.GoodSub(false);
// Initial Position
Initial += 1;
if (Initial == 0 || Initial
== 8)
Initial = 1;
// New Game Load
New_Game_Sub();
}
// Stop Load
***************************************************
private void Stop_Load()
{
// Load Timers
TimerFlag = false;
Timer1.Enabled = false;
Timer2.Enabled = false;
Timer3.Enabled = false;
Timer4.Enabled = false;
// New Game, First Time
after Load
vtime = System.DateTime.Now;
New_Game_interval = vtime;
// Panel2
Lb22.Text = G1[4].ToString();
Lb23.Text = G5[1].ToString();
Lb24.Text = G3[2].ToString();
// Panel4
Lb41.Text = G1[3].ToString();
Lb43.Text = G7[1].ToString();
Lb44.Text = G5[2].ToString();
// Panel6
Lb61.Text = G3[3].ToString();
Lb62.Text = G5[4].ToString();
Lb63.Text = G9[1].ToString();
// Panel8
Lb81.Text = G5[3].ToString();
Lb82.Text = G7[4].ToString();
Lb84.Text = G9[2].ToString();
// Initial Position
Initial_Position();
// New Game, Interval Timer
Flag
Flg_Time = true;
//
Toolbar1.Buttons[2].Enabled
= true;
LTImer.Visible = true;
LInterval.Visible = true;
LOne.Visible = false;
// Timer Counter Format,
Begin
LInterval.Text = " ---
00:00:00 --- ";
Timer_Welcome.Enabled =
false;
Welcome_Flag = false;
WelcomeSub(false);
}
private void
TimerCircle_Tick(object
sender, EventArgs e)
{
// Show circle designs
CircleDemo();
}
// Show circle designs
*********************************
private void CircleDemo()
{
//Pens
Pen vPen1 = new
Pen(Color.Black, 3);
Pen vPen2 = new
Pen(Color.Azure, 3);
Pen vPen3 = new
Pen(Color.Blue, 3);
Pen vPen4 = new
Pen(Color.Red, 3);
int col1;
int col2; // Colors
int col3;
int col4; // Colors
int x1;
int y1;
int rd; // Rectangle
// Random values
if (vrnd0 < 0 || vrnd0 > 2)
vrnd0 = 0.1;
else
vrnd0 += 0.1;
// rgb Color
if
(System.Convert.ToInt16(125
* vrnd0) <= 255)
col1 =
System.Convert.ToInt16(125 *
vrnd0);
else
col1 = 125;
if
(System.Convert.ToInt16(150
* vrnd0) <= 255)
col2 =
System.Convert.ToInt16(150 *
vrnd0);
else
col2 = 150;
if
(System.Convert.ToInt16(155
* vrnd0) <= 255)
col3 =
System.Convert.ToInt16(155 *
vrnd0);
else
col3 = 155;
if
(System.Convert.ToInt16(125
* vrnd0) <= 255)
col4 =
System.Convert.ToInt16(125 *
vrnd0);
else
col4 = 125;
vPen1 = new
Pen(Color.FromArgb(col1,
col2, col3, col4), 3);
vPen2 = new
Pen(Color.FromArgb(col2,
col3, col4, col1), 3);
vPen3 = new
Pen(Color.FromArgb(col3,
col4, col1, col2), 3);
vPen4 = new
Pen(Color.FromArgb(col4,
col1, col2, col3), 3);
// Rectangle coord.
x1 = this.PictureBox1.Width
/ 3;
y1 = this.PictureBox1.Height
/ 3;
rd =
System.Convert.ToInt16(((x1
* 0.9) + 5) * vrnd0);
// Draw ellipses
// Graphics
ex =
this.PictureBox1.CreateGraphics();
// Draw ellipse to screen.
ex.DrawEllipse(vPen1, 0, 0,
2 * rd, 2 * rd);
ex.DrawEllipse(vPen2, 3 *
x1, 0, -2 * rd, 2 * rd);
ex.DrawEllipse(vPen3, 0, 3 *
y1, 2 * rd, -2 * rd);
ex.DrawEllipse(vPen4, 3 *
x1, 3 * y1, -2 * rd, -2 *
rd);
}
private void
Timer_Welcome_Tick(object
sender, EventArgs e)
{
// Activate, Show the word -
Welcome
if (Welcome_Flag == true)
Welcome_demo();
// Activate, Show the word -
The Good
else
{
if (TheGood_Flag == true)
TheGood_demo();
}
}
// Show the word - Welcome
**********************************
private void Welcome_demo()
{
if (Vcount < 0)
{
Vcount += 1;
}
else
{
switch (Vcount)
{
case 1:
Lwelcome.Text = "Welcome";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Olive;
Vcount += 1;
break;
case 2:
Lwelcome.Text = "W";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Navy;
Vcount += 1;
break;
case 3:
Lwelcome.Text = "We";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Red;
Vcount += 1;
break;
case 4:
Lwelcome.Text = "Wel";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Teal;
Vcount += 1;
break;
case 5:
Lwelcome.Text = "Welc";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Black;
Vcount += 1;
break;
case 6:
Lwelcome.Text = "Welco";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Maroon;
Vcount += 1;
break;
case 7:
Lwelcome.Text = "Welcom";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Blue;
Vcount += 1;
break;
case 8:
Lwelcome.Text = "Welcome";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Orchid;
Vcount += 1;
break;
case 9:
Lwelcome.Text = "Welcome
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Green;
Vcount = 1;
break;
}
}
}
// Show the Word - The Good
**********************************
private void TheGood_demo()
{
switch (Vcount)
{
case 1:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Olive;
LInterval.BackColor =
System.Drawing.Color.Olive;
this.PictureBox3.Visible =
false;
this.PictureBox2.Visible =
true;
Vcount += 1;
break;
case 2:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Green;
LInterval.BackColor =
System.Drawing.Color.Green;
this.PictureBox2.Visible =
false;
this.PictureBox3.Visible =
true;
Vcount += 1;
break;
case 3:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Orchid;
LInterval.BackColor =
System.Drawing.Color.Orchid;
this.PictureBox3.Visible =
false;
this.PictureBox2.Visible =
true;
Vcount += 1;
break;
case 4:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Blue;
LInterval.BackColor =
System.Drawing.Color.Blue;
this.PictureBox2.Visible =
false;
this.PictureBox3.Visible =
true;
Vcount += 1;
break;
case 5:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Maroon;
LInterval.BackColor =
System.Drawing.Color.Maroon;
this.PictureBox3.Visible =
false;
this.PictureBox2.Visible =
true;
Vcount += 1;
break;
case 6:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Black;
LInterval.BackColor =
System.Drawing.Color.Black;
this.PictureBox2.Visible =
false;
this.PictureBox3.Visible =
true;
Vcount += 1;
break;
case 7:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Teal;
LInterval.BackColor =
System.Drawing.Color.Teal;
this.PictureBox3.Visible =
false;
this.PictureBox2.Visible =
true;
Vcount += 1;
break;
case 8:
Lwelcome.Text = "The Good
...";
this.Lwelcome.Font = new
System.Drawing.Font("Times
New Roman", 26.25F,
System.Drawing.FontStyle.Bold,
System.Drawing.GraphicsUnit.Point,
((System.Byte)(178)));
this.Lwelcome.ForeColor =
System.Drawing.Color.Red;
LInterval.BackColor =
System.Drawing.Color.Red;
this.PictureBox2.Visible =
false;
this.PictureBox3.Visible =
true;
Vcount = 1;
break;
}
}
// Test procedure
*************************************
private void FaceGame_test()
{
int Fcount;
Fcount = 0;
if ((Panel1.Location.X) <=
200)
Fcount+= 1;
if ((Panel2.Location.X) <=
200)
Fcount+= 1;
if ((Panel3.Location.X) <=
200)
Fcount+= 1;
if ((Panel4.Location.X) <=
200)
Fcount+= 1;
if ((Panel5.Location.X) <=
200)
Fcount+= 1;
if ((Panel6.Location.X) <=
200)
Fcount+= 1;
if ((Panel7.Location.X) <=
200)
Fcount+= 1;
if ((Panel8.Location.X) <=
200)
Fcount+= 1;
if ((Panel9.Location.X) <=
200)
Fcount+= 1;
// Test if All Game
Operations is Available
if (Fcount == 9)
{
// Stopped all Function
under Timer_Interval
Flg_Time = false;
this.GoodSub(true);
}
}
private void
ToolStripButtonN_Click(object
sender, EventArgs e)
{
New_Game();
}
private void
ToolStripButtonD_Click(object
sender, EventArgs e)
{
Demo Df = new Demo();
Df.Show();
}
private void
ToolStripButtonA_Click(object
sender, EventArgs e)
{
Aboout Ab = new Aboout();
Ab.Show();
}
private void
ToolStripButtonE_Click(object
sender, EventArgs e)
{
Application.Exit();
}
}
} |
|
|
|
|
|
|
|
|
|
|
8- |
Demo.cs,
2nd Form of
FG-C2019 project/Application |
|
8.1 |
View Design |
|
|
|
 |
8.2 |
View Codes |
|
|
 |
the Code of Demo Form |
|
the Code of Demo.cs Form of
FG-C2019 Game Application
developed with Microsoft Visual
Studio Community 2019, C# - Face
Game |
|
|
|
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
FG_C2019
{
public
partial
class
Demo
: Form
{
//Variables
System.DateTime Vtime;
System.DateTime
StartDemo_Date;
bool
Demo_Move_Flag;
bool
Demo_Interval_Flag;
bool
Begin_demo;
long
Vinterval_demo;
int
Vcount;
int
DemoCounter1 = 0;
public
Demo()
{
InitializeComponent();
}
private
void
Demo_Load(object
sender, EventArgs e)
{
Vcount = 0;
xPanel1.SetBounds((512),
(208), 96, 96);
xPanel2.SetBounds((320),
(112), 96, 96);
xPanel3.SetBounds((320),
(208), 96, 96);
xPanel4.SetBounds((416),
(208), 96, 96);
xPanel5.SetBounds((512),
(16), 96, 96);
xPanel6.SetBounds((416),
(16), 96, 96);
xPanel7.SetBounds((416),
(112), 96, 96);
xPanel8.SetBounds((512),
(112), 96, 96);
xPanel9.SetBounds((320),
(16), 96, 96);
this.Timerclock.Enabled
=
true;
this.PictureBox1.Visible
=
false;
Begin_demo =
true;
}
private
void
Demo_Timer_Tick(object
sender, EventArgs e)
{
TheDemo();
if
(Demo_Move_Flag)
{
DemoCounter1 =
DemoCounter1 + 1;
DemoSub();
}
}
private
void
DemoSub()
{
int
Lleft;
int
Ltop;
if
(DemoCounter1 == 1)
xPanel8.SetBounds((8),
(112), 96, 96);
else
{
if
(DemoCounter1 == 2)
xPanel1.SetBounds((8),
(16), 96, 96);
else
{
if
(DemoCounter1 == 3)
xPanel2.SetBounds((104),
(112), 96, 96);
else
{
if
(DemoCounter1 == 4)
xPanel3.SetBounds((104),
(16), 96, 96);
else
{
if
(DemoCounter1 == 5)
xPanel4.SetBounds((8),
(208), 96, 96);
else
{
if
(DemoCounter1 == 6)
xPanel5.SetBounds((200),
(16), 96, 96);
else
{
if
(DemoCounter1 == 7)
xPanel9.SetBounds((104),
(208), 96, 96);
else
{
if
(DemoCounter1 == 8)
xPanel6.SetBounds((200),
(208), 96, 96);
else
{
if
(DemoCounter1 == 9)
xPanel7.SetBounds((200),
(112), 96, 96);
else
{
if
(DemoCounter1 == 10)
this.PictureBox1.Visible
=
true;
Demo_Char_MultiColor();
Lleft = 320 + (3 * ( this.xPanel1.Width)
-
this.PictureBox1.Width)
/ 2;
Ltop = 18 + (3 * ( this.xPanel1.Height)
-
this.PictureBox1.Height)/
2;
this.PictureBox1.Location
=
new
System.Drawing.Point(Lleft,
Ltop);
Demo_Move_Flag =
false;
Demo_Interval_Flag =
false;
}
}
}
}
}
}
}
}
}
}
private
void
Demo_Char_MultiColor()
{
lb13.ForeColor =
Color.LavenderBlush;
lb14.ForeColor =
Color.LavenderBlush;
lb21.ForeColor =
Color.Gold;
lb22.ForeColor =
Color.Gold;
lb23.ForeColor =
Color.Gold;
lb24.ForeColor =
Color.Gold;
lb32.ForeColor =
Color.LavenderBlush;
lb33.ForeColor =
Color.Gold;
lb34.ForeColor =
Color.LavenderBlush;
lb41.ForeColor =
Color.LavenderBlush;
lb44.ForeColor =
Color.LavenderBlush;
lb52.ForeColor =
Color.LavenderBlush;
lb53.ForeColor =
Color.LavenderBlush;
lb61.ForeColor =
Color.LavenderBlush;
lb62.ForeColor =
Color.LavenderBlush;
lb71.ForeColor =
Color.LavenderBlush;
lb72.ForeColor =
Color.Gold;
lb73.ForeColor =
Color.LavenderBlush;
lb81.ForeColor =
Color.LavenderBlush;
lb83.ForeColor =
Color.LavenderBlush;
lb84.ForeColor =
Color.Gold;
lb91.ForeColor =
Color.Gold;
lb92.ForeColor =
Color.LavenderBlush;
lb94.ForeColor =
Color.LavenderBlush;
}
private
void
Timerclock_Tick(object
sender, EventArgs e)
{
// Clock
Vtime =
System.DateTime.Now;
this.Ltime1.Text
=
System.DateTime.Now.ToLongTimeString();
// Timer Interval
if
(Demo_Interval_Flag)
{
Vinterval_demo = ((Vtime.Hour
* 60 * 60) + (Vtime.Minute *
60) + Vtime.Second) - ((StartDemo_Date.Hour
* 60 * 60) + (StartDemo_Date.Minute
* 60) +
StartDemo_Date.Second);
LIntervalDemo.Text =
Vinterval_demo.ToString() +
" Sec";
}
}
private
void
TheDemo()
{
Vcount = Vcount + 1;
if
(Vcount == 1)
{
LDemo.ForeColor =
Color.Red;
this.PictureBox1.Image
=
this.PictureBox2.Image;
}
else
{
if
(Vcount == 2)
{
LDemo.ForeColor =
Color.Navy;
this.PictureBox1.Image
=
this.PictureBox3.Image;
}
else
{
if
(Vcount == 3)
LDemo.ForeColor =
Color.Salmon;
this.PictureBox1.Image
=
this.PictureBox2.Image;
if
(Begin_demo)
{
Demo_Move_Flag =
true;
Vtime =
System.DateTime.Now;
StartDemo_Date =
System.DateTime.Now;
LTImer.Visible =
true;
LIntervalDemo.Visible =
true;
Demo_Interval_Flag =
true;
Begin_demo =
false;
this.PictureBox1.Image
=
this.PictureBox3.Image;
}
else
{
if
(Vcount == 4)
{
LDemo.ForeColor =
Color.Green;
this.PictureBox1.Image
=
this.PictureBox2.Image;
}
else
{
if
(Vcount == 5)
{
LDemo.ForeColor =
Color.Brown;
this.PictureBox1.Image
=
this.PictureBox3.Image;
Vcount = 0;
}
}
}
}
}
}
private
void
Btnclose_Click(object
sender, EventArgs e)
{
// To close the current form
this.Close();
}
}
}
|
|
|
|
|
|
|
|
|
|
|
9- |
Aboout.cs,
3th Form of
FG-C2019 project/Application |
|
9.1 |
View Design |
|
 |
|
|
9.2 |
View Codes |
|
|
 |
the Code of Aboout Form |
|
the Code of Aboout.cs Form of
FG-C2019 Game Application
developed with Microsoft Visual
Studio Community 2019, C# - Face
Game |
|
|
|
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
System.Windows.Forms;
namespace
FG_C2019
{
public
partial
class
Aboout
: Form
{
//Variable
int
IcoNmbr;
public
Aboout()
{
InitializeComponent();
}
private
void
Aboout_Load(object
sender, EventArgs e)
{
IcoNmbr = 0;
this.Timer1.Enabled
=
true;
}
private
void
Btndone_Click(object
sender, EventArgs e)
{
// To close the current form
this.Close();
}
private
void
Timer1_Tick(object
sender, EventArgs e)
{
if
(IcoNmbr == 0)
{
this.picico.Image
=
this.picicoOrg0.Image;
IcoNmbr = 1;
}
else
{
this.picico.Image
=
this.picicoOrg1.Image;
IcoNmbr = 0;
}
}
}
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| | |