|
FaceGameNet.vb
DemoForm.vb
|
|
1. |
FaceGameNet.vb
Imports
System.Drawing
Imports
System.Resources
Imports System.Console
Public
Class
FaceGame
Inherits
System.Windows.Forms.Form
'
Variables
Dim vobject
As
New
Panel
Dim vtime
As
New
System.DateTime
Dim New_Game_BTime
As
DateTime
Dim
New_Game_interval
As
DateTime
Dim FaceGametest
As
Boolean
Dim Flg_Time
As
Boolean
Dim TimerFlag
As
Boolean
Dim Welcome_Flag
As
Boolean
Dim TheGood_Flag
As
Boolean
Dim vstate
As
Short
Dim Vcount
As
Integer = 0
Dim Initial
As
Integer
Dim VlocationX
As
Integer, VlocationY
As
Integer
Dim A(9, 4)
As
String
Dim G_Box(9)
As
String
Dim G_Flag(9)
As
Boolean
Dim LP(9, 2)
As
Integer
Dim G1(4)
As
Integer
Dim G2(4)
As
Integer
Dim G3(4)
As
Integer
Dim G4(4)
As
Integer
Dim G5(4)
As
Integer
Dim G6(4)
As
Integer
Dim G7(4)
As
Integer
Dim G8(4)
As
Integer
Dim G9(4)
As
Integer
Private
Sub
FaceGame_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
'
Resize
'
LWelcome
Me.PWelcome.Height =
290
Me.PWelcome.Width =
290
Me.Lwelcome.Top = (Me.PWelcome.Height
- Me.Lwelcome.Height)
/ 2
Me.Lwelcome.Left = (Me.PWelcome.Width
- Me.Lwelcome.Width)
/ 2
'
PictureBox1
Me.PPicture.Height =
290
Me.PPicture.Width =
290
Me.PictureBox1.Location
=
New
Point(0,
0)
Me.PictureBox1.Height
= Me.PPicture.Height
Me.PictureBox1.Width
= Me.PPicture.Width
Me.PPicture1.Height
= 290
Me.PPicture1.Width =
290
Me.PictureBox2.Top =
(Me.PPicture1.Height
- Me.PictureBox2.Height)
/ 2
Me.PictureBox2.Left
= (Me.PPicture1.Width
- Me.PictureBox2.Width)
/ 2
Me.PictureBox3.Top =
(Me.PPicture1.Height
- Me.PictureBox3.Height)
/ 2
Me.PictureBox3.Left
= (Me.PPicture1.Width
- Me.PictureBox3.Width)
/ 2
'
Initial Position
Initial = 1
'
New Game Load Procedure
New_Game_Sub()
End
Sub
'
New Game Load Procedure
Private
Sub
New_Game_Sub()
Dim Initial_Flag
As
Object
FaceGametest =
True
WelcomeSub( True)
'
Initialisation
Initial_Array()
LOne.Visible =
True
'
Initial Position Sub
Initial_Flag =
True
Initial_Position()
'
Start Timer Load, New Game
New_Game_BTime =
Date.Now
Flg_Time =
False
TimerFlag =
True
Timer1.Enabled =
True
Timer2.Enabled =
True
Timer3.Enabled =
True
Timer4.Enabled =
True
End
Sub
'
Show the word - Welcome
Private
Sub
WelcomeSub(ByVal
weloperation
As
Boolean)
If weloperation =
True
Then
Me.PictureBox1.CreateGraphics.Clear(SystemColors.Control)
ToolBar1.Buttons(1).Enabled =
False
Me.LTImer.Visible =
False
Me.LInterval.Visible
=
False
'
Welcome
Me.Lwelcome.Text =
" "
Vcount = 1
Me.PWelcome.Location
=
New
Point(8,
80)
Timer_Welcome.Enabled =
True
Welcome_Flag =
True
'
Circle
Me.PPicture.Location
=
New
Point(320,
80)
TimerCircle.Enabled =
True
ElseIf weloperation
=
False
Then
ToolBar1.Buttons(1).Enabled =
True
Me.LTImer.Visible =
True
Me.LInterval.Text =
" "
Me.LInterval.BackColor
=
SystemColors.Desktop
Me.LInterval.Visible
=
True
'
Welcome
Me.PWelcome.Location
=
New
Point(8,
464)
Timer_Welcome.Enabled =
False
Welcome_Flag =
False
'
Circle
Me.PPicture.Location
=
New
Point(264,
464)
TimerCircle.Enabled =
False
End
If
End
Sub
Private
Sub
Initial_Array()
Dim i1
As
Short
Dim i2
As
Short
For i1 = 0
To
9
For i2 = 0
To
4
A(i1, i2) =
""
Next
Next
For i1 = 0
To
9
G_Flag(i1) =
False
Next
For i1 = 0
To
9
G_Box(i1) =
""
Next
End
Sub
'
Different positions show
Private
Sub
Initial_Position()
'
Initial Position
Select
Case
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
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
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
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
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
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
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
End
Select
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)
End
Sub
'Panels collections
Private
Sub
Panel1_MouseUp(ByVal
sender
As
System.Object,
ByVal e
As
System.Windows.Forms.MouseEventArgs)
Handles
Panel1.MouseUp
subcursor(sender, e)
subcursor1(lb11, lb12, lb13, lb14)
End
Sub
Private
Sub
Panel2_MouseUp(ByVal
sender
As
System.Object,
ByVal e
As
System.Windows.Forms.MouseEventArgs)
Handles
Panel2.MouseUp
subcursor(sender, e)
subcursor1(lb21, lb22, lb23, lb24)
End
Sub
Private
Sub
Panel3_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel3.MouseUp
subcursor(sender, e)
subcursor1(lb31, lb32, lb33, lb34)
End
Sub
Private
Sub
Panel4_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel4.MouseUp
subcursor(sender, e)
subcursor1(lb41, lb42, lb43, lb44)
End
Sub
Private
Sub
Panel5_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel5.MouseUp
subcursor(sender, e)
subcursor1(lb51, lb52, lb53, lb54)
End
Sub
Private
Sub
Panel6_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel6.MouseUp
subcursor(sender, e)
subcursor1(lb61, lb62, lb63, lb64)
End
Sub
Private
Sub
Panel7_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel7.MouseUp
subcursor(sender, e)
subcursor1(lb71, lb72, lb73, lb74)
End
Sub
Private
Sub
Panel8_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel8.MouseUp
subcursor(sender, e)
subcursor1(lb81, lb82, lb83, lb84)
End
Sub
Private
Sub
Panel9_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
Panel9.MouseUp
subcursor(sender, e)
subcursor1(lb91, lb92, lb93, lb94)
End
Sub
Private
Sub
subcursor(ByVal
vsender
As
Object,
ByVal
ve
As
System.Windows.Forms.MouseEventArgs)
vobject = vsender
If ve.Button =
MouseButtons.Left
Then
vobject.Cursor =
Cursors.No
vstate = 1
VlocationX = vobject.Location.X
VlocationY = vobject.Location.Y
Beep()
ElseIf ve.Button =
MouseButtons.Right
Then
vstate = 0
vobject.Cursor =
Cursors.Default
End
If
End
Sub
Private
Sub
subcursor1(ByVal
vlb1
As
Object,
ByVal
vlb2
As
Object,
ByVal
vlb3
As
Object,
ByVal
vlb4
As
Object)
vlb1.Cursor = vobject.Cursor
vlb2.Cursor = vobject.Cursor
vlb3.Cursor = vobject.Cursor
vlb4.Cursor = vobject.Cursor
End
Sub
Private
Sub
FaceGame_MouseMove(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles
MyBase.MouseMove
Dim indexx
As
String
Dim EX
As
Integer
Dim EY
As
Integer
'
First Group, X
If e.X >= 0
And
e.X < 104
Then
EX = 8
If e.X >= 104
And
e.X < 200
Then
EX = 104
If e.X >= 200
And
e.X < 296
Then
EX = 200
'
Second Group, X
If e.X >= 296
And
e.X < 416
Then
EX = 320
If e.X >= 416
And
e.X < 512
Then
EX = 416
If e.X >= 512
And
e.X <= (Me.Width)
Then
EX = 512
'
Y
If e.Y >= 0
And
e.Y < 176
Then
EY = 80
If e.Y >= 176
And
e.Y < 272
Then
EY = 176
If e.Y >= 272
And
e.Y < (Me.Height)
Then
EY = 272
indexx = Microsoft.VisualBasic.Right(vobject.Name, 1)
If vstate = 1
Then
LSelect.Text =
" "
If EX > 296
Then
If VlocationX > 296
Then
'
Move to
vobject.SetBounds((LP(Val(indexx), 1)), (LP(Val(indexx),
2)), 96, 96)
SubCondition(indexx)
LSelect.Text =
"Operation
not available"
Exit Sub
ElseIf VlocationX <
296
Then
'
Clear
Verification_Value()
'
Move to
vobject.SetBounds((LP(Val(indexx), 1)), (LP(Val(indexx),
2)), 96, 96)
SubCondition(indexx)
Exit Sub
End
If
ElseIf EX < 296
Then
'
Move to
vobject.SetBounds((EX), (EY), 96, 96)
'
Clear
Verification_Value()
'
Store Information
G_Flag(Val(indexx)) =
True
'
Calcul
Calcul_Value(indexx, EX, EY)
'
Test
Equal_Value(indexx, EX, EY)
SubCondition(indexx)
Exit Sub
End
If
End
If
End
Sub
Private
Sub
Verification_Value()
If VlocationX = 8
And
VlocationY = 80
Then
A(1, 1) =
""
A(1, 2) =
""
ElseIf VlocationX =
8
And VlocationY = 176
Then
A(2, 1) =
""
A(2, 2) =
""
A(2, 3) =
""
ElseIf VlocationX =
8
And VlocationY = 272
Then
A(3, 1) =
""
A(3, 2) =
""
ElseIf VlocationX =
104
And VlocationY = 80
Then
A(4, 1) =
""
A(4, 2) =
""
A(4, 3) =
""
ElseIf VlocationX =
104
And VlocationY = 176
Then
A(5, 1) =
""
A(5, 2) =
""
A(5, 3) =
""
A(5, 4) =
""
ElseIf VlocationX =
104
And VlocationY = 272
Then
A(6, 1) =
""
A(6, 2) =
""
A(6, 3) =
""
ElseIf VlocationX =
200
And VlocationY = 80
Then
A(7, 1) =
""
A(7, 2) =
""
ElseIf VlocationX =
200
And VlocationY = 176
Then
A(8, 1) =
""
A(8, 2) =
""
A(8, 3) =
""
ElseIf VlocationX =
200
And VlocationY = 272
Then
A(9, 1) =
""
A(9, 2) =
""
End
If
End
Sub
Private
Sub
SubCondition(ByVal
idx
As
String)
vobject.Cursor =
Cursors.Default
vstate = 0
If idx =
"1"
Then
subcursor1(lb11, lb12, lb13, lb14)
ElseIf idx =
"2"
Then
subcursor1(lb21, lb22, lb23, lb24)
ElseIf idx =
"3"
Then
subcursor1(lb31, lb32, lb33, lb34)
ElseIf idx =
"4"
Then
subcursor1(lb41, lb42, lb43, lb44)
ElseIf idx =
"5"
Then
subcursor1(lb51, lb52, lb53, lb54)
ElseIf idx =
"6"
Then
subcursor1(lb61, lb62, lb63, lb64)
ElseIf idx =
"7"
Then
subcursor1(lb71, lb72, lb73, lb74)
ElseIf idx =
"8"
Then
subcursor1(lb81, lb82, lb83, lb84)
ElseIf idx =
"9"
Then
subcursor1(lb91, lb92, lb93, lb94)
End
If
End
Sub
Private
Sub
Calcul_Value(ByRef
indx
As
String,
ByRef
VarX
As
Integer,
ByRef
VarY
As
Integer)
If G_Flag(Val(indx))
=
False
Then
G_Flag(Val(indx)) =
True
End
If
If VarX = 8
And
VarY = 80
Then
G_Box(Val(indx)) =
"1"
Select
Case
indx
Case
"1"
A(1, 1) = lb13.Text
A(1, 2) = lb14.Text
Case
"2"
A(1, 1) = lb23.Text
A(1, 2) = lb24.Text
Case
"3"
A(1, 1) = lb33.Text
A(1, 2) = lb34.Text
Case
"4"
A(1, 1) = lb43.Text
A(1, 2) = lb44.Text
Case
"5"
A(1, 1) = lb53.Text
A(1, 2) = lb54.Text
Case
"6"
A(1, 1) = lb63.Text
A(1, 2) = lb64.Text
Case
"7"
A(1, 1) = lb73.Text
A(1, 2) = lb74.Text
Case
"8"
A(1, 1) = lb83.Text
A(1, 2) = lb84.Text
Case
"9"
A(1, 1) = lb93.Text
A(1, 2) = lb94.Text
End
Select
ElseIf VarX = 8
And
VarY = 176
Then
G_Box(Val(indx)) =
"2"
Select
Case
indx
Case
"1"
A(2, 1) = lb11.Text
A(2, 2) = lb13.Text
A(2, 3) = lb14.Text
Case
"2"
A(2, 1) = lb21.Text
A(2, 2) = lb23.Text
A(2, 3) = lb24.Text
Case
"3"
A(2, 1) = lb31.Text
A(2, 2) = lb33.Text
A(2, 3) = lb34.Text
Case
"4"
A(2, 1) = lb41.Text
A(2, 2) = lb43.Text
A(2, 3) = lb44.Text
Case
"5"
A(2, 1) = lb51.Text
A(2, 2) = lb53.Text
A(2, 3) = lb54.Text
Case
"6"
A(2, 1) = lb61.Text
A(2, 2) = lb63.Text
A(2, 3) = lb64.Text
Case
"7"
A(2, 1) = lb71.Text
A(2, 2) = lb73.Text
A(2, 3) = lb74.Text
Case
"8"
A(2, 1) = lb81.Text
A(2, 2) = lb83.Text
A(2, 3) = lb84.Text
Case
"9"
A(2, 1) = lb91.Text
A(2, 2) = lb93.Text
A(2, 3) = lb94.Text
End
Select
ElseIf VarX = 8
And
VarY = 272
Then
G_Box(Val(indx)) =
"3"
Select
Case
indx
Case
"1"
A(3, 1) = lb11.Text
A(3, 2) = lb14.Text
Case
"2"
A(3, 1) = lb21.Text
A(3, 2) = lb24.Text
Case
"3"
A(3, 1) = lb31.Text
A(3, 2) = lb34.Text
Case
"4"
A(3, 1) = lb41.Text
A(3, 2) = lb44.Text
Case
"5"
A(3, 1) = lb51.Text
A(3, 2) = lb54.Text
Case
"6"
A(3, 1) = lb61.Text
A(3, 2) = lb64.Text
Case
"7"
A(3, 1) = lb71.Text
A(3, 2) = lb74.Text
Case
"8"
A(3, 1) = lb81.Text
A(3, 2) = lb84.Text
Case
"9"
A(3, 1) = lb91.Text
A(3, 2) = lb94.Text
End
Select
ElseIf VarX = 104
And
VarY = 80
Then
G_Box(Val(indx)) =
"4"
Select
Case
indx
Case
"1"
A(4, 1) = lb12.Text
A(4, 2) = lb13.Text
A(4, 3) = lb14.Text
Case
"2"
A(4, 1) = lb22.Text
A(4, 2) = lb23.Text
A(4, 3) = lb24.Text
Case
"3"
A(4, 1) = lb32.Text
A(4, 2) = lb33.Text
A(4, 3) = lb34.Text
Case
"4"
A(4, 1) = lb42.Text
A(4, 2) = lb43.Text
A(4, 3) = lb44.Text
Case
"5"
A(4, 1) = lb52.Text
A(4, 2) = lb53.Text
A(4, 3) = lb54.Text
Case
"6"
A(4, 1) = lb62.Text
A(4, 2) = lb63.Text
A(4, 3) = lb64.Text
Case
"7"
A(4, 1) = lb72.Text
A(4, 2) = lb73.Text
A(4, 3) = lb74.Text
Case
"8"
A(4, 1) = lb82.Text
A(4, 2) = lb83.Text
A(4, 3) = lb84.Text
Case
"9"
A(4, 1) = lb92.Text
A(4, 2) = lb93.Text
A(4, 3) = lb94.Text
End
Select
ElseIf VarX = 104
And
VarY = 176
Then
G_Box(Val(indx)) =
"5"
Select
Case
indx
Case
"1"
A(5, 1) = lb11.Text
A(5, 2) = lb12.Text
A(5, 3) = lb13.Text
A(5, 4) = lb14.Text
Case
"2"
A(5, 1) = lb21.Text
A(5, 2) = lb22.Text
A(5, 3) = lb23.Text
A(5, 4) = lb24.Text
Case
"3"
A(5, 1) = lb31.Text
A(5, 2) = lb32.Text
A(5, 3) = lb33.Text
A(5, 4) = lb34.Text
Case
"4"
A(5, 1) = lb41.Text
A(5, 2) = lb42.Text
A(5, 3) = lb43.Text
A(5, 4) = lb44.Text
Case
"5"
A(5, 1) = lb51.Text
A(5, 2) = lb52.Text
A(5, 3) = lb53.Text
A(5, 4) = lb54.Text
Case
"6"
A(5, 1) = lb61.Text
A(5, 2) = lb62.Text
A(5, 3) = lb63.Text
A(5, 4) = lb64.Text
Case
"7"
A(5, 1) = lb71.Text
A(5, 2) = lb72.Text
A(5, 3) = lb73.Text
A(5, 4) = lb74.Text
Case
"8"
A(5, 1) = lb81.Text
A(5, 2) = lb82.Text
A(5, 3) = lb83.Text
A(5, 4) = lb84.Text
Case
"9"
A(5, 1) = lb91.Text
A(5, 2) = lb92.Text
A(5, 3) = lb93.Text
A(5, 4) = lb94.Text
End
Select
ElseIf VarX = 104
And
VarY = 272
Then
G_Box(Val(indx)) =
"6"
Select
Case
indx
Case
"1"
A(6, 1) = lb11.Text
A(6, 2) = lb12.Text
A(6, 3) = lb14.Text
Case
"2"
A(6, 1) = lb21.Text
A(6, 2) = lb22.Text
A(6, 3) = lb24.Text
Case
"3"
A(6, 1) = lb31.Text
A(6, 2) = lb32.Text
A(6, 3) = lb34.Text
Case
"4"
A(6, 1) = lb41.Text
A(6, 2) = lb42.Text
A(6, 3) = lb44.Text
Case
"5"
A(6, 1) = lb51.Text
A(6, 2) = lb52.Text
A(6, 3) = lb54.Text
Case
"6"
A(6, 1) = lb61.Text
A(6, 2) = lb62.Text
A(6, 3) = lb64.Text
Case
"7"
A(6, 1) = lb71.Text
A(6, 2) = lb72.Text
A(6, 3) = lb74.Text
Case
"8"
A(6, 1) = lb81.Text
A(6, 2) = lb82.Text
A(6, 3) = lb84.Text
Case
"9"
A(6, 1) = lb91.Text
A(6, 2) = lb92.Text
A(6, 3) = lb94.Text
End
Select
ElseIf VarX = 200
And
VarY = 80
Then
G_Box(Val(indx)) =
"7"
Select
Case
indx
Case
"1"
A(7, 1) = lb12.Text
A(7, 2) = lb13.Text
Case
"2"
A(7, 1) = lb22.Text
A(7, 2) = lb23.Text
Case
"3"
A(7, 1) = lb32.Text
A(7, 2) = lb33.Text
Case
"4"
A(7, 1) = lb42.Text
A(7, 2) = lb43.Text
Case
"5"
A(7, 1) = lb52.Text
A(7, 2) = lb53.Text
Case
"6"
A(7, 1) = lb62.Text
A(7, 2) = lb63.Text
Case
"7"
A(7, 1) = lb72.Text
A(7, 2) = lb73.Text
Case
"8"
A(7, 1) = lb82.Text
A(7, 2) = lb83.Text
Case
"9"
A(7, 1) = lb92.Text
A(7, 2) = lb93.Text
End
Select
ElseIf VarX = 200
And
VarY = 176
Then
G_Box(Val(indx)) =
"8"
Select
Case
indx
Case
"1"
A(8, 1) = lb11.Text
A(8, 2) = lb12.Text
A(8, 3) = lb13.Text
Case
"2"
A(8, 1) = lb21.Text
A(8, 2) = lb22.Text
A(8, 3) = lb23.Text
Case
"3"
A(8, 1) = lb31.Text
A(8, 2) = lb32.Text
A(8, 3) = lb33.Text
Case
"4"
A(8, 1) = lb41.Text
A(8, 2) = lb42.Text
A(8, 3) = lb43.Text
Case
"5"
A(8, 1) = lb51.Text
A(8, 2) = lb52.Text
A(8, 3) = lb53.Text
Case
"6"
A(8, 1) = lb61.Text
A(8, 2) = lb62.Text
A(8, 3) = lb63.Text
Case
"7"
A(8, 1) = lb71.Text
A(8, 2) = lb72.Text
A(8, 3) = lb73.Text
Case
"8"
A(8, 1) = lb81.Text
A(8, 2) = lb82.Text
A(8, 3) = lb83.Text
Case
"9"
A(8, 1) = lb91.Text
A(8, 2) = lb92.Text
A(8, 3) = lb93.Text
End
Select
ElseIf VarX = 200
And
VarY = 272
Then
G_Box(Val(indx)) =
"9"
Select
Case
indx
Case
"1"
A(9, 1) = lb11.Text
A(9, 2) = lb12.Text
Case
"2"
A(9, 1) = lb21.Text
A(9, 2) = lb22.Text
Case
"3"
A(9, 1) = lb31.Text
A(9, 2) = lb32.Text
Case
"4"
A(9, 1) = lb41.Text
A(9, 2) = lb42.Text
Case
"5"
A(9, 1) = lb51.Text
A(9, 2) = lb52.Text
Case
"6"
A(9, 1) = lb61.Text
A(9, 2) = lb62.Text
Case
"7"
A(9, 1) = lb71.Text
A(9, 2) = lb72.Text
Case
"8"
A(9, 1) = lb81.Text
A(9, 2) = lb82.Text
Case
"9"
A(9, 1) = lb91.Text
A(9, 2) = lb92.Text
End
Select
End
If
End
Sub
'
Test, Equal Values
Private
Sub
Equal_Value(ByRef
indx
As
String,
ByRef
VarX
As
Integer,
ByRef
VarY
As
Integer)
If VarX = 8
And
VarY = 80
Then
If A(2, 1) <>
""
Then
If A(1, 1) <> A(2,
1)
Then
A(1, 1) =
""
A(1, 2) =
""
GoTo Pt_Equal
End
If
End
If
If A(4, 1) <>
""
Then
If A(1, 2) <> A(4,
1)
Then
A(1, 1) =
""
A(1, 2) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 8
And
VarY = 176
Then
If A(1, 1) <>
""
Then
If A(2, 1) <> A(1,
1)
Then
A(2, 1) =
""
A(2, 2) =
""
A(2, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(3, 1) <>
""
Then
If A(2, 2) <> A(3,
1)
Then
A(2, 1) =
""
A(2, 2) =
""
A(2, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(5, 2) <>
""
Then
If A(2, 3) <> A(5,
2)
Then
A(2, 1) =
""
A(2, 2) =
""
A(2, 3) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 8
And
VarY = 272
Then
If A(2, 2) <>
""
Then
If A(3, 1) <> A(2,
2)
Then
A(3, 1) =
""
A(3, 2) =
""
GoTo Pt_Equal
End
If
End
If
If A(6, 2) <>
""
Then
If A(3, 2) <> A(6,
2)
Then
A(3, 1) =
""
A(3, 2) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 104
And
VarY = 80
Then
If A(1, 2) <>
""
Then
If A(4, 1) <> A(1,
2)
Then
A(4, 1) =
""
A(4, 2) =
""
A(4, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(5, 1) <>
""
Then
If A(4, 2) <> A(5,
1)
Then
A(4, 1) =
""
A(4, 2) =
""
A(4, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(7, 1) <>
""
Then
If A(4, 3) <> A(7,
1)
Then
A(4, 1) =
""
A(4, 2) =
""
A(4, 3) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 104
And
VarY = 176
Then
If A(4, 2) <>
""
Then
If A(5, 1) <> A(4,
2)
Then
A(5, 1) =
""
A(5, 2) =
""
A(5, 3) =
""
A(5, 4) =
""
GoTo Pt_Equal
End
If
End
If
If A(2, 3) <>
""
Then
If A(5, 2) <> A(2,
3)
Then
A(5, 1) =
""
A(5, 2) =
""
A(5, 3) =
""
A(5, 4) =
""
GoTo Pt_Equal
End
If
End
If
If A(6, 1) <>
""
Then
If A(5, 3) <> A(6,
1)
Then
A(5, 1) =
""
A(5, 2) =
""
A(5, 3) =
""
A(5, 4) =
""
GoTo Pt_Equal
End
If
End
If
If A(8, 2) <>
""
Then
If A(5, 4) <> A(8,
2)
Then
A(5, 1) =
""
A(5, 2) =
""
A(5, 3) =
""
A(5, 4) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 104
And
VarY = 272
Then
If A(5, 3) <>
""
Then
If A(6, 1) <> A(5,
3)
Then
A(6, 1) =
""
A(6, 2) =
""
A(6, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(3, 2) <>
""
Then
If A(6, 2) <> A(3,
2)
Then
A(6, 1) =
""
A(6, 2) =
""
A(6, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(9, 2) <>
""
Then
If A(6, 3) <> A(9,
2)
Then
A(6, 1) =
""
A(6, 2) =
""
A(6, 3) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 200
And
VarY = 80
Then
If A(4, 3) <>
""
Then
If A(7, 1) <> A(4,
3)
Then
A(7, 1) =
""
A(7, 2) =
""
GoTo Pt_Equal
End
If
End
If
If A(8, 1) <>
""
Then
If A(7, 2) <> A(8,
1)
Then
A(7, 1) =
""
A(7, 2) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 200
And
VarY = 176
Then
If A(7, 2) <>
""
Then
If A(8, 1) <> A(7,
2)
Then
A(8, 1) =
""
A(8, 2) =
""
A(8, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(5, 4) <>
""
Then
If A(8, 2) <> A(5,
4)
Then
A(8, 1) =
""
A(8, 2) =
""
A(8, 3) =
""
GoTo Pt_Equal
End
If
End
If
If A(9, 1) <>
""
Then
If A(8, 3) <> A(9,
1)
Then
A(8, 1) =
""
A(8, 2) =
""
A(8, 3) =
""
GoTo Pt_Equal
End
If
End
If
ElseIf VarX = 200
And
VarY = 272
Then
If A(8, 3) <>
""
Then
If A(9, 1) <> A(8,
3)
Then
A(9, 1) =
""
A(9, 2) =
""
GoTo Pt_Equal
End
If
End
If
If A(6, 3) <>
""
Then
If A(9, 2) <> A(6,
3)
Then
A(9, 1) =
""
A(9, 2) =
""
GoTo Pt_Equal
End
If
End
If
End
If
Exit Sub
Pt_Equal:
SubCondition(indx)
'
Move to
vobject.SetBounds((LP(Val(indx), 1)), (LP(Val(indx),
2)), 96, 96)
LSelect.Text =
"Equal,
operation is aborted"
End
Sub
'
Labels ...
Private
Sub
lb11_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb11.MouseUp
Me.Panel1_MouseUp(Me.Panel1,
e)
End
Sub
Private
Sub
lb12_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb12.MouseUp
Me.Panel1_MouseUp(Me.Panel1,
e)
End
Sub
Private
Sub
lb13_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb13.MouseUp
Me.Panel1_MouseUp(Me.Panel1,
e)
End
Sub
Private
Sub
lb14_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb14.MouseUp
Me.Panel1_MouseUp(Me.Panel1,
e)
End
Sub
Private
Sub
lb21_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb21.MouseUp
Me.Panel2_MouseUp(Me.Panel2,
e)
End
Sub
Private
Sub
lb22_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb22.MouseUp
Me.Panel2_MouseUp(Me.Panel2,
e)
End
Sub
Private
Sub
lb23_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb23.MouseUp
Me.Panel2_MouseUp(Me.Panel2,
e)
End
Sub
Private
Sub
lb24_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb24.MouseUp
Me.Panel2_MouseUp(Me.Panel2,
e)
End
Sub
Private
Sub
lb31_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb31.MouseUp
Me.Panel3_MouseUp(Me.Panel3,
e)
End
Sub
Private
Sub
lb32_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb32.MouseUp
Me.Panel3_MouseUp(Me.Panel3,
e)
End
Sub
Private
Sub
lb33_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb33.MouseUp
Me.Panel3_MouseUp(Me.Panel3,
e)
End
Sub
Private
Sub
lb34_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb34.MouseUp
Me.Panel3_MouseUp(Me.Panel3,
e)
End
Sub
Private
Sub
lb41_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb41.MouseUp
Me.Panel4_MouseUp(Me.Panel4,
e)
End
Sub
Private
Sub
lb42_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb42.MouseUp
Me.Panel4_MouseUp(Me.Panel4,
e)
End
Sub
Private
Sub
lb43_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb43.MouseUp
Me.Panel4_MouseUp(Me.Panel4,
e)
End
Sub
Private
Sub
lb44_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb44.MouseUp
Me.Panel4_MouseUp(Me.Panel4,
e)
End
Sub
Private
Sub
lb51_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb51.MouseUp
Me.Panel5_MouseUp(Me.Panel5,
e)
End
Sub
Private
Sub
lb52_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb52.MouseUp
Me.Panel5_MouseUp(Me.Panel5,
e)
End
Sub
Private
Sub
lb53_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb53.MouseUp
Me.Panel5_MouseUp(Me.Panel5,
e)
End
Sub
Private
Sub
lb54_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb54.MouseUp
Me.Panel5_MouseUp(Me.Panel5,
e)
End
Sub
Private
Sub
lb61_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb61.MouseUp
Me.Panel6_MouseUp(Me.Panel6,
e)
End
Sub
Private
Sub
lb62_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb62.MouseUp
Me.Panel6_MouseUp(Me.Panel6,
e)
End
Sub
Private
Sub
lb63_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb63.MouseUp
Me.Panel6_MouseUp(Me.Panel6,
e)
End
Sub
Private
Sub
lb64_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb64.MouseUp
Me.Panel6_MouseUp(Me.Panel6,
e)
End
Sub
Private
Sub
lb71_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb71.MouseUp
Me.Panel7_MouseUp(Me.Panel7,
e)
End
Sub
Private
Sub
lb72_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb72.MouseUp
Me.Panel7_MouseUp(Me.Panel7,
e)
End
Sub
Private
Sub
lb73_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb73.MouseUp
Me.Panel7_MouseUp(Me.Panel7,
e)
End
Sub
Private
Sub
lb74_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb74.MouseUp
Me.Panel7_MouseUp(Me.Panel7,
e)
End
Sub
Private
Sub
lb81_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb81.MouseUp
Me.Panel8_MouseUp(Me.Panel8,
e)
End
Sub
Private
Sub
lb82_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb82.MouseUp
Me.Panel8_MouseUp(Me.Panel8,
e)
End
Sub
Private
Sub
lb83_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb83.MouseUp
Me.Panel8_MouseUp(Me.Panel8,
e)
End
Sub
Private
Sub
lb84_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb84.MouseUp
Me.Panel8_MouseUp(Me.Panel8,
e)
End
Sub
Private
Sub
lb91_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb91.MouseUp
Me.Panel9_MouseUp(Me.Panel9,
e)
End
Sub
Private
Sub
lb92_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb92.MouseUp
Me.Panel9_MouseUp(Me.Panel9,
e)
End
Sub
Private
Sub
lb93_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb93.MouseUp
Me.Panel9_MouseUp(Me.Panel9,
e)
End
Sub
Private
Sub
lb94_MouseUp(ByVal
sender
As
Object,
ByVal
e As
System.Windows.Forms.MouseEventArgs)
Handles lb94.MouseUp
Me.Panel9_MouseUp(Me.Panel9,
e)
End
Sub
Private
Sub
Timer2_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles Timer2.Tick
Dim i
As
Integer
Dim j
As
Integer
If TimerFlag
Then
'
Group7 - Frame
For i = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G7(i) = Int(9 * Rnd()) + 1
End
If
Next
lb71.Text = G7(1)
lb72.Text = G7(2)
lb73.Text = G7(3)
lb74.Text = G7(4)
'
Group9 - Frame
For j = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G9(j) = Int(9 * Rnd()) + 1
End
If
Next
lb91.Text = G9(1)
lb92.Text = G9(2)
lb93.Text = G9(3)
lb94.Text = G9(4)
End
If
End
Sub
Private
Sub
Timer3_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles Timer3.Tick
Dim i
As
Integer
Dim j
As
Integer
If TimerFlag
Then
'
Panel2
For j = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G2(j) = Int(9 * Rnd()) + 1
End
If
Next
lb21.Text = G2(1)
lb22.Text = G2(2)
lb23.Text = G2(3)
lb24.Text = G2(4)
'
Panel4
For i = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G4(i) = Int(9 * Rnd()) + 1
End
If
Next
lb41.Text = G4(1)
lb42.Text = G4(2)
lb43.Text = G4(3)
lb44.Text = G4(4)
End
If
End
Sub
Private
Sub
Timer4_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles Timer4.Tick
Dim j
As
Integer
Dim k
As
Integer
If TimerFlag
Then
'
Panel6
For k = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G6(k) = Int(9 * Rnd()) + 1
End
If
Next
lb61.Text = G6(1)
lb62.Text = G6(2)
lb63.Text = G6(3)
lb64.Text = G6(4)
'
Panel8
For j = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G8(j) = Int(9 * Rnd()) + 1
End
If
Next
lb81.Text = G8(1)
lb82.Text = G8(2)
lb83.Text = G8(3)
lb84.Text = G8(4)
End
If
End
Sub
Private
Sub
Timer1_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles Timer1.Tick
Dim i
As
Integer
Dim j
As
Integer
Dim k
As
Integer
If TimerFlag
Then
'
Panel1
For i = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G1(i) = Int(9 * Rnd()) + 1
End
If
Next
lb11.Text = G1(1)
lb12.Text = G1(2)
lb13.Text = G1(3)
lb14.Text = G1(4)
'
Panel3
For j = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G3(j) = Int(9 * Rnd()) + 1
End
If
Next
lb31.Text = G3(1)
lb32.Text = G3(2)
lb33.Text = G3(3)
lb34.Text = G3(4)
'
Panel5
For k = 1
To
4
If Int(9 * Rnd()) +
1 <> 0
Then
G5(k) = Int(9 * Rnd()) + 1
End
If
Next
lb51.Text = G5(1)
lb52.Text = G5(2)
lb53.Text = G5(3)
lb54.Text = G5(4)
End
If
End
Sub
Private
Sub
Timer_clock_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
Timer_clock.Tick
'
Clock
Me.ltime1.Text =
Date.Now.ToLongTimeString.ToString
'
Timer Interval
Dim vinterval_game
As
Long
= DateDiff(DateInterval.Second,
New_Game_interval,
Date.Now)
If Flg_Time
Then
LInterval.Text = vinterval_game.ToString &
" Sec"
'
Stop The Load
If TimerFlag
Then
Dim vinterval_load
As
Long
= DateDiff(DateInterval.Second,
New_Game_BTime,
Date.Now)
If vinterval_load >
4
Then Stop_Load()
End
If
If FaceGametest
Then
FaceGame_test()
End
Sub
Private
Sub
GoodSub(ByVal
good_Operation
As
Boolean)
If good_Operation =
True
Then
FaceGametest =
False
Me.Lwelcome.Text =
" "
Vcount = 1
Timer_Welcome.Enabled =
True
Me.PWelcome.Location
=
New
Point(8,
80)
Me.PPicture1.Location
=
New
Point(320,
80)
Me.PictureBox2.Visible
=
False
Me.PictureBox3.Visible
=
False
Welcome_Flag =
False
TheGood_Flag =
True
Else
Me.LTImer.Visible =
False
Me.LInterval.Visible
=
False
Timer_Welcome.Enabled =
False
Me.PWelcome.Location
=
New
Point(8,
464)
Me.PPicture1.Location
=
New
Point(504,
464)
Welcome_Flag =
False
TheGood_Flag =
False
Beep()
End
If
End
Sub
Private
Sub
ToolBar1_ButtonClick(ByVal
sender
As
System.Object,
ByVal e
As
System.Windows.Forms.ToolBarButtonClickEventArgs)
Handles
ToolBar1.ButtonClick
Select
Case
ToolBar1.Buttons.IndexOf(e.Button)
Case 1
New_Game()
Case 3
Dim ff
As
New
DemoForm
ff.ShowDialog()
Case 5
Dim f1
As
New
AboutForm
f1.ShowDialog()
Case 7
Application.Exit()
End
Select
End
Sub
'
Load New Game
Public
Sub
New_Game()
Me.GoodSub(False)
'
Initial Position
Initial = Initial + 1
If Initial = 0
Or
Initial = 8
Then
Initial = 1
'
New Game Load
New_Game_Sub()
End
Sub
'
Stop Load
Private
Sub
Stop_Load()
'
Load Timers
TimerFlag =
False
Timer1.Enabled =
False
Timer2.Enabled =
False
Timer3.Enabled =
False
Timer4.Enabled =
False
'
New Game, First Time after Load
New_Game_interval =
Date.Now
'
Panel2
lb22.Text =
CStr(G1(4))
lb23.Text =
CStr(G5(1))
lb24.Text =
CStr(G3(2))
'
Panel4
lb41.Text =
CStr(G1(3))
lb43.Text =
CStr(G7(1))
lb44.Text =
CStr(G5(2))
'
Panel6
lb61.Text =
CStr(G3(3))
lb62.Text =
CStr(G5(4))
lb63.Text =
CStr(G9(1))
'
Panel8
lb81.Text =
CStr(G5(3))
lb82.Text =
CStr(G7(4))
lb84.Text =
CStr(G9(2))
'
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)
End
Sub
Private
Sub
TimerCircle_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
TimerCircle.Tick
'
Show circle designs
CircleDemo()
End
Sub
'
Show circle designs
Private
Sub
CircleDemo()
Dim vPen1
As
Pen,
vPen2
As
Pen,
vPen3
As
Pen,
vPen4
As
Pen
'Pens
Dim Col1
As
Integer, col2
As
Integer
' Colors
Dim col3
As
Integer, col4
As
Integer
' Colors
Dim x1
As
Integer, y1
As
Integer, rd
As
Integer
' Rectangle
'
rgb Color
Col1 = 125 * Rnd()
col2 = 150 * Rnd()
col3 = 255 * Rnd()
col4 = 125 * Rnd()
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 =
Me.PictureBox1.Width
/ 3
y1 =
Me.PictureBox1.Height
/ 3
rd = ((x1 * 0.9) + 5) * Rnd()
'
Draw ellipses
Me.PictureBox1.CreateGraphics.DrawEllipse(vPen1,
0, 0, 2 * rd, 2 * rd)
Me.PictureBox1.CreateGraphics.DrawEllipse(vPen2,
3 * x1, 0, -2 * rd, 2 * rd)
Me.PictureBox1.CreateGraphics.DrawEllipse(vPen3,
0, 3 * y1, 2 * rd, -2 * rd)
Me.PictureBox1.CreateGraphics.DrawEllipse(vPen4,
3 * x1, 3 * y1, -2 * rd, -2 * rd)
End
Sub
Private
Sub
Timer_Welcome_Tick(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
Timer_Welcome.Tick
'
Activate, Show the word - Welcome
If Welcome_Flag
Then
Welcome_demo()
'
Activate, Show the word - The Good
ElseIf TheGood_Flag
Then
TheGood_demo()
End
If
End
Sub
'
Show the word - Welcome
Private
Sub
Welcome_demo()
If Vcount < 0
Then
Vcount = Vcount + 1
ElseIf Vcount = 1
Then
Lwelcome.Text =
"Welcome"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Olive
Vcount = Vcount + 1
ElseIf Vcount = 2
Then
Lwelcome.Text =
"W"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Navy
Vcount = Vcount + 1
ElseIf Vcount = 3
Then
Lwelcome.Text =
"We"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Red
Vcount = Vcount + 1
ElseIf Vcount = 4
Then
Lwelcome.Text =
"Wel"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Teal
Vcount = Vcount + 1
ElseIf Vcount = 5
Then
Lwelcome.Text =
"Welc"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Black
Vcount = Vcount + 1
ElseIf Vcount = 6
Then
Lwelcome.Text =
"Welco"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Maroon
Vcount = Vcount + 1
ElseIf Vcount = 7
Then
Lwelcome.Text =
"Welcom"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Blue
Vcount = Vcount + 1
ElseIf Vcount = 8
Then
Lwelcome.Text =
"Welcome"
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Orchid
Vcount = Vcount + 1
ElseIf Vcount = 9
Then
Lwelcome.Text =
"Welcome
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Green
Vcount = 1
End
If
End
Sub
'
Show the Word - The Good
Private
Sub
TheGood_demo()
If Vcount = 1
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Olive
LInterval.BackColor =
Color.Olive
Me.PictureBox3.Visible
=
False
Me.PictureBox2.Visible
=
True
Vcount = Vcount + 1
ElseIf Vcount = 2
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Green
LInterval.BackColor =
Color.Green
Me.PictureBox2.Visible
=
False
Me.PictureBox3.Visible
=
True
Vcount = Vcount + 1
Beep()
ElseIf Vcount = 3
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Orchid
LInterval.BackColor =
Color.Orchid
Me.PictureBox3.Visible
=
False
Me.PictureBox2.Visible
=
True
Vcount = Vcount + 1
ElseIf Vcount = 4
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Blue
LInterval.BackColor =
Color.Blue
Me.PictureBox2.Visible
=
False
Me.PictureBox3.Visible
=
True
Vcount = Vcount + 1
Beep()
ElseIf Vcount = 5
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Maroon
LInterval.BackColor =
Color.Maroon
Me.PictureBox3.Visible
=
False
Me.PictureBox2.Visible
=
True
Vcount = Vcount + 1
ElseIf Vcount = 6
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Black
LInterval.BackColor =
Color.Black
Me.PictureBox2.Visible
=
False
Me.PictureBox3.Visible
=
True
Vcount = Vcount + 1
Beep()
ElseIf Vcount = 7
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
CType((FontStyle.Bold
Or
FontStyle.Italic),
FontStyle),
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Teal
LInterval.BackColor =
Color.Teal
Me.PictureBox3.Visible
=
False
Me.PictureBox2.Visible
=
True
Vcount = Vcount + 1
Beep()
ElseIf Vcount = 8
Then
Lwelcome.Text =
"The Good
..."
Me.Lwelcome.Font =
New
Font("Times
New Roman", 27.75!,
FontStyle.Bold,
GraphicsUnit.Point,
CType(0,
Byte))
Me.Lwelcome.ForeColor
=
Color.Red
LInterval.BackColor =
Color.Red
Me.PictureBox2.Visible
=
False
Me.PictureBox3.Visible
=
True
Vcount = 1
End
If
End
Sub
'
Test procedure
Private
Sub
FaceGame_test()
Dim Fcount
As
Integer
Fcount = 0
If
(Panel1.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel2.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel3.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel4.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel5.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel6.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel7.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel8.Location.X) <= 200
Then
Fcount = Fcount + 1
If
(Panel9.Location.X) <= 200
Then
Fcount = Fcount + 1
'
Test if All Game Operations is Available
If Fcount = 9
Then
'
Stopped all Function under Timer_Interval
Flg_Time =
False
Me.GoodSub(True)
End
If
End
Sub
Private
Sub
MenuItem2_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MenuItem2.Click
New_Game()
End
Sub
Private
Sub
MenuItem4_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MenuItem4.Click
Dim ff
As
New
DemoForm
ff.ShowDialog()
End
Sub
Private
Sub
MenuItem6_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MenuItem6.Click
Dim f1
As
New
AboutForm
f1.ShowDialog()
End
Sub
Private
Sub
MenuItem8_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MenuItem8.Click
Application.Exit()
End
Sub
End
Class |

|
2. |
DemoForm.vb
Imports
System.Console
Public
Class
DemoForm
Inherits
System.Windows.Forms.Form
Dim vtime
As
New
System.DateTime
Dim StartDemo_Date
As
DateTime
Dim Demo_Move_Flag
As
Boolean
Dim
Demo_Interval_Flag
As
Boolean
Dim begin_demo
As
Boolean
Dim vinterval_demo
As
Long
Dim Vcount
As
Integer = 0
Dim DemoCounter1
As
Integer
Private
Sub
DemoForm_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
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)
PPicture.Height = 290
PPicture.Width = 290
Me.PictureBox1.Top =
(Me.PPicture.Height
- Me.PictureBox1.Height)
/ 2
Me.PictureBox1.Left
= (Me.PPicture.Width
- Me.PictureBox1.Width)
/ 2
PPicture.SetBounds(16, 368, 290, 290)
Me.Timerclock.Enabled
=
True
begin_demo =
True
End
Sub
Private
Sub
btnclose_Click(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
btnclose.Click
Me.Close()
FFaceGameNet.New_Game()
End
Sub
Private
Sub
Demo_Timer_Tick(ByVal
Sender
As
System.Object,
ByVal eventArgs
As
System.EventArgs)
Handles
Demo_Timer.Tick
TheDemo()
If Demo_Move_Flag
Then
DemoCounter1 = DemoCounter1 + 1
demoSub()
If DemoCounter1 = 11
Then
Beep()
Beep()
Beep()
Demo_Move_Flag =
False
Demo_Interval_Flag =
False
ElseIf DemoCounter1
>= 0
And
DemoCounter1 <= 9
Then
Beep()
End
If
End
If
End
Sub
Private
Sub
demoSub()
If DemoCounter1 = 1
Then
xPanel8.SetBounds((8), (112), 96, 96)
ElseIf DemoCounter1
= 2
Then
xPanel1.SetBounds((8), (16), 96, 96)
ElseIf DemoCounter1
= 3
Then
xPanel2.SetBounds((104), (112), 96, 96)
ElseIf DemoCounter1
= 4
Then
xPanel3.SetBounds((104), (16), 96, 96)
ElseIf DemoCounter1
= 5
Then
xPanel4.SetBounds((8), (208), 96, 96)
ElseIf DemoCounter1
= 6
Then
xPanel5.SetBounds((200), (16), 96, 96)
ElseIf DemoCounter1
= 7
Then
xPanel9.SetBounds((104), (208), 96, 96)
ElseIf DemoCounter1
= 8
Then
xPanel6.SetBounds((200), (208), 96, 96)
ElseIf DemoCounter1
= 9
Then
xPanel7.SetBounds((200), (112), 96, 96)
ElseIf DemoCounter1
= 10
Then
PPicture.SetBounds(320, 16, 288, 288)
Demo_Char_MultiColor()
End
If
End
Sub
Private
Sub
Demo_Char_MultiColor()
lb13.ForeColor =
Color.Green
lb14.ForeColor =
Color.Green
lb21.ForeColor =
Color.Red
lb22.ForeColor =
Color.Red
lb23.ForeColor =
Color.Red
lb24.ForeColor =
Color.Red
lb32.ForeColor =
Color.Green
lb33.ForeColor =
Color.Red
lb34.ForeColor =
Color.Green
lb41.ForeColor =
Color.Green
lb44.ForeColor =
Color.Green
lb52.ForeColor =
Color.Green
lb53.ForeColor =
Color.Green
lb61.ForeColor =
Color.Green
lb62.ForeColor =
Color.Green
lb71.ForeColor =
Color.Green
lb72.ForeColor =
Color.Red
lb73.ForeColor =
Color.Green
lb81.ForeColor =
Color.Green
lb83.ForeColor =
Color.Green
lb84.ForeColor =
Color.Red
lb91.ForeColor =
Color.Red
lb92.ForeColor =
Color.Green
lb94.ForeColor =
Color.Green
End
Sub
Private
Sub
Timerclock_Tick(ByVal
eventSender
As
System.Object,
ByVal eventArgs
As
System.EventArgs)
Handles
Timerclock.Tick
'
Clock
Me.Ltime1.Text =
Date.Now.ToLongTimeString.ToString
'
Timer Interval
If
Demo_Interval_Flag
Then
vinterval_demo = DateDiff( DateInterval.Second,
StartDemo_Date,
Date.Now)
LIntervalDemo.Text = Str(vinterval_demo) &
" Sec"
End
If
End
Sub
Private
Sub
TheDemo()
Vcount = Vcount + 1
If Vcount = 1
Then
LDemo.ForeColor =
Color.Red
ElseIf Vcount = 2
Then
LDemo.ForeColor =
Color.Navy
ElseIf Vcount = 3
Then
LDemo.ForeColor =
Color.Salmon
If begin_demo
Then
Demo_Move_Flag =
True
StartDemo_Date =
Date.Now
LTImer.Visible =
True
LIntervalDemo.Visible =
True
Demo_Interval_Flag =
True
begin_demo =
False
End
If
ElseIf Vcount = 4
Then
LDemo.ForeColor =
Color.Green
ElseIf Vcount = 5
Then
LDemo.ForeColor =
Color.Brown
Vcount = 0
End
If
End
Sub
Private
Sub
DemoForm_Closed(ByVal
sender
As
Object,
ByVal
e As
System.EventArgs)
Handles
MyBase.Closed
FFaceGameNet.New_Game()
End
Sub
End
Class | | |

|
|