📄 form1.frm
字号:
Index = 8
Left = 2160
Picture = "Form1.frx":14AF32
Top = 4440
Width = 1050
End
Begin VB.Image Image1
Height = 1425
Index = 7
Left = 3000
Picture = "Form1.frx":14FE20
Top = 1320
Width = 1035
End
Begin VB.Image Image1
Height = 1425
Index = 6
Left = 2640
Picture = "Form1.frx":154B92
Top = 2160
Width = 1050
End
Begin VB.Image Image1
Height = 1440
Index = 5
Left = 3960
Picture = "Form1.frx":159A80
Top = 3240
Width = 1050
End
Begin VB.Image Image1
Height = 1425
Index = 4
Left = 3360
Picture = "Form1.frx":15EA42
Top = 5040
Width = 1065
End
Begin VB.Image Image1
Height = 1440
Index = 3
Left = 2880
Picture = "Form1.frx":163AAC
Top = 2280
Width = 1035
End
Begin VB.Image Image1
Height = 1425
Index = 2
Left = 6840
Picture = "Form1.frx":1688EE
Top = 3120
Width = 1050
End
Begin VB.Image Image1
Height = 1425
Index = 1
Left = 2160
Picture = "Form1.frx":16D7DC
Top = 3720
Width = 1065
End
Begin VB.Image Image1
Height = 1440
Index = 0
Left = 1920
Picture = "Form1.frx":172846
Top = 4680
Width = 1065
End
End
Begin VB.Menu file
Caption = "文件"
Visible = 0 'False
Begin VB.Menu start
Caption = "开始"
Shortcut = {F2}
End
Begin VB.Menu quit
Caption = "退出"
Shortcut = ^X
End
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public ax As Integer
Public atop As Integer
Public atopc As Integer
Public nt As Integer
Public l As Integer
Public order As Integer
Public x As Integer
Public y As Integer
Dim berflag(0 To 53) As Integer
Dim rest(1 To 50) As Integer
Dim m(1 To 3) As Integer
Dim centern(1 To 17) As Integer
Dim leftn(1 To 17) As Integer
Dim rightn(1 To 17) As Integer
Private Sub Command1_Click()
Winsock1.RemoteHost = Form1.Tet1.Text
Winsock1.SendData "55"
Winsock1.RemoteHost = Form1.Tet3.Text
Winsock1.SendData "55"
Command1.Visible = False
Command2.Visible = False
Label7.Visible = False
End Sub
Private Sub Command2_Click()
Dim nn As Integer
Dim ge As Integer
For i = 0 To 53
If Image1(i).Visible = True Then
If Image1(i).Top = atop - 400 Then
Image1(i).Top = atopc
Winsock1.RemoteHost = Form1.Tet1.Text
Winsock1.SendData i
Winsock1.RemoteHost = Form1.Tet1.Text
Winsock1.SendData i
End If
End If
Next
Command1.Visible = False
Command2.Visible = False
End Sub
Private Sub Command3_Click()
Dim n As Integer
Dim corec As Integer
Dim corel As Integer
Dim corer As Integer
corec = 1
corel = 1
corer = 1
For i = 0 To 53
Image1(i).Visible = False
berflag(i) = 0
Next
n = 0
For i = 1 To 3
Randomize
rest(i) = Rnd * 53
Image1(rest(i)).Visible = True
Next
Image1(rest(i)).Left = 4000 + (i - 1) * 150
Image1(rest(i)).Top = 500
If rest(1) < rest(2) Then
If rest(2) < rest(3) Then
m(1) = rest(1)
m(2) = rest(2)
m(3) = rest(3)
Else
If rest(1) < rest(3) Then
m(1) = rest(1)
m(2) = rest(3)
m(3) = rest(2)
Else
m(1) = rest(3)
m(2) = rest(1)
m(3) = rest(2)
End If
End If
Else
If rest(3) > rest(1) Then
m(1) = rest(2)
m(2) = rest(1)
m(3) = rest(3)
Else
If rest(2) < rest(3) Then
m(1) = rest(2)
m(2) = rest(3)
m(3) = rest(1)
Else
m(1) = rest(3)
m(2) = rest(2)
m(3) = rest(1)
End If
End If
End If
For i = 1 To 3
Image1(m(i)).Left = 3000 + (i - 1) * 1200
Image1(m(i)).Top = 500
Winsock4.RemoteHost = Form1.Tet1.Text
Winsock4.SendData m(i)
Winsock4.RemoteHost = Form1.Tet3.Text
Winsock4.SendData m(i)
Next
For i = 0 To 53
If i = rest(1) Or i = rest(2) Or i = rest(3) Then i = i + 1
Randomize
flag = Rnd * 3
If flag <= 1 Then
If corec < 18 Then
If n = 0 Then
at = i
n = 1
End If
berflag(i) = 1
centern(corec) = i
corec = corec + 1
Else
If corel < 18 Then
leftn(corel) = i
corel = corel + 1
Else
rightn(corer) = i
corer = corer + 1
End If
End If
End If
If flag > 1 And flag <= 2 Then
If corel < 18 Then
leftn(corel) = i
corel = corel + 1
Else
If corec < 18 Then
berflag(i) = 1
centern(corec) = i
corec = corec + 1
Else
rightn(corer) = i
corer = corer + 1
End If
End If
End If
If flag > 2 Then
If corer < 18 Then
leftn(corer) = i
corer = corer + 1
Else
If corec < 18 Then
berflag(i) = 1
centern(corec) = i
corec = corec + 1
Else
leftn(corel) = i
corel = corel + 1
End If
End If
End If
Next
Image1(at).Left = 2300
Image1(at).Top = atop
Image1(at).Visible = True
ass = Image1(at).Left
For i = 0 To 53
If berflag(i) = 1 Then
Image1(i).Visible = True
Image1(i).Left = ass + 250
Image1(i).Top = atop
ass = Image1(i).Left
End If
Next
For i = 0 To 19
Image2(i).Visible = True
Next
If Form1.Text1 = 1 Then
Command1.Visible = True
Command2.Visible = True
End If
Winsock2.RemoteHost = Form1.Tet1.Text
For i = 1 To 17
Winsock2.SendData leftn(i)
Next
Winsock3.RemoteHost = Form1.Tet3.Text
For i = 1 To 17
Winsock3.SendData rightn(i)
Next
Command3.Visible = False
End Sub
Private Sub Form_Load()
l = 0
Winsock1.Protocol = sckUDPProtocol
Winsock1.LocalPort = 5002
Winsock1.RemotePort = 5002
Winsock1.RemoteHost = Winsock1.LocalIP
Winsock1.SendData ""
Winsock2.Protocol = sckUDPProtocol
Winsock2.LocalPort = 5003
Winsock2.RemotePort = 5003
Winsock2.RemoteHost = Winsock1.LocalIP
Winsock2.SendData ""
Winsock3.Protocol = sckUDPProtocol
Winsock3.LocalPort = 5004
Winsock3.RemotePort = 5004
Winsock3.RemoteHost = Winsock1.LocalIP
Winsock3.SendData ""
Winsock4.Protocol = sckUDPProtocol
Winsock4.LocalPort = 5004
Winsock4.RemotePort = 5004
Winsock4.RemoteHost = Winsock1.LocalIP
Winsock4.SendData ""
ax = 2800
inter = 60
atop = 6500
atopc = 2800
Image1(0).Left = ax
Image1(0).Top = atopc
For i = 1 To 53
Image1(i).Left = Image1(i - 1).Left + inter
Image1(i).Top = atopc
Next
Image2(0).Left = 8100
Image2(0).Top = 4200
Image2(10).Left = 200
Image2(10).Top = 4200
For i = 1 To 9
Image2(i).Left = Image2(0).Left
Image2(i).Top = Image2(i - 1).Top - 250
Next
For i = 11 To 19
Image2(i).Left = Image2(10).Left
Image2(i).Top = Image2(i - 1).Top - 250
Next
For i = 0 To 19
Image2(i).Visible = False
Next
Command1.Visible = False
Command2.Visible = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Form1
Winsock1.Close
Winsock2.Close
Winsock3.Close
Winsock4.Close
End Sub
Private Sub Image1_Click(Index As Integer)
If order = 1 Then
If Image1(Index).Top = atop Then
Image1(Index).Top = Image1(Index).Top - 400
Exit Sub
End If
If Image1(Index).Top = atop - 400 Then
Image1(Index).Top = Image1(Index).Top + 400
Exit Sub
End If
End If
End Sub
Private Sub Winsock2_DataArrival(ByVal bytesTotal As Long)
Dim gg As String
Winsock2.GetData gg, vbString
If gg <> "" Then
bb = Val(gg)
If bb = 55 Then
Label8.Visible = False
Exit Sub
End If
y = y + 1
bb = Val(gg)
Command1.Visible = True
Command1.Visible = True
Image1(bb).Left = 900
Image1(bb).Top = 800 + y * 150
End If
End Sub
'Private Sub Image1_DblClick(Index As Integer)
'If order = 1 Then
'For i = 0 To 53
'If Image1(i).Visible = True Then
'If Image1(i).Top <> atop Then
'Image1(i).Top = atopc
'End If
'End If
'End If
'Next
'Command1.Visible = False
'Command1.Visible = False
'End Sub
Private Sub Winsock3_DataArrival(ByVal bytesTotal As Long)
Dim gg As String
Winsock3.GetData gg, vbString
If gg <> "" Then
bb = Val(gg)
If bb = 55 Then
Label9.Visible = False
Exit Sub
End If
l = l + 1
Image1(bb).Left = 5000
Image1(bb).Top = l * 500 + 500
End If
End Sub
Private Sub Winsock4_DataArrival(ByVal bytesTotal As Long)
Dim gg As String
Winsock4.GetData gg, vbString
If gg <> "" Then
bb = Val(gg)
x = x + 1
Image1(bb).Left = 900 + x * 500
Image1(bb).Top = 500
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -