📄 form1.frm
字号:
Width = 975
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "发送数据:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 120
TabIndex = 27
Top = 7560
Width = 975
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "接受数据:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 120
TabIndex = 26
Top = 7080
Width = 975
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "对方IP:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 180
Index = 0
Left = 240
TabIndex = 25
Top = 6600
Width = 795
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 27
Left = 5160
Shape = 3 'Circle
Top = 3000
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 26
Left = 5160
Shape = 3 'Circle
Top = 2520
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 19
Left = 4200
Shape = 5 'Rounded Square
Top = 1560
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 18
Left = 4200
Shape = 5 'Rounded Square
Top = 2040
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 17
Left = 4200
Shape = 5 'Rounded Square
Top = 2520
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 16
Left = 4200
Shape = 5 'Rounded Square
Top = 3000
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 15
Left = 4200
Shape = 5 'Rounded Square
Top = 3480
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 14
Left = 8640
Shape = 5 'Rounded Square
Top = 1200
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 13
Left = 8640
Shape = 5 'Rounded Square
Top = 3000
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 12
Left = 8640
Shape = 5 'Rounded Square
Top = 2520
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 11
Left = 8640
Shape = 5 'Rounded Square
Top = 4680
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 10
Left = 8640
Shape = 5 'Rounded Square
Top = 4200
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 9
Left = 8640
Shape = 5 'Rounded Square
Top = 6480
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 8
Left = 8640
Shape = 5 'Rounded Square
Top = 6000
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 7
Left = 8640
Shape = 5 'Rounded Square
Top = 7800
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 1
Left = 5160
Shape = 3 'Circle
Top = 2040
Width = 255
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
Height = 255
Index = 0
Left = 5160
Shape = 3 'Circle
Top = 1560
Width = 255
End
Begin VB.Line Line2
X1 = 5880
X2 = 5880
Y1 = 0
Y2 = 9000
End
Begin VB.Line Line1
Index = 5
X1 = 5880
X2 = 9840
Y1 = 9000
Y2 = 9000
End
Begin VB.Line Line1
Index = 4
X1 = 7320
X2 = 9840
Y1 = 7200
Y2 = 7200
End
Begin VB.Line Line1
Index = 3
X1 = 7320
X2 = 9840
Y1 = 5400
Y2 = 5400
End
Begin VB.Line Line1
Index = 2
X1 = 7320
X2 = 9840
Y1 = 3600
Y2 = 3600
End
Begin VB.Line Line1
Index = 1
X1 = 7320
X2 = 9840
Y1 = 1800
Y2 = 1800
End
Begin VB.Line Line1
Index = 0
X1 = 5880
X2 = 9840
Y1 = 0
Y2 = 0
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim f_left As Boolean
Dim f_right As Boolean
Dim f_up As Boolean
Dim f_down As Boolean
Dim A As Integer
Dim aaa As String
Private Sub Command1_Click(Index As Integer)
A = Command1(Index).Index
End Sub
Private Sub Command2_Click()
Winsock1.RemoteHost = Text3.Text
Winsock1.RemotePort = 1002
Text4.Text = Winsock1.RemotePort
Winsock1.LocalPort = 0
Winsock1.Connect
Command2.Enabled = False
Command3.Enabled = True
End Sub
Private Sub Command3_Click()
Winsock1.Close
Command2.Enabled = True
Command3.Enabled = False
End Sub
Private Sub Command4_Click()
If Winsock1.State <> sckClosed Then Winsock1.Close
End
End Sub
Private Sub Form_Load()
End Sub
Private Sub Text1_Change()
If Winsock1.State = sckConnected Then Winsock1.SendData Text1.Text
End Sub
Private Sub Timer1_Timer()
Dim X(32) As Integer, U1 As Integer, U8 As Integer
Dim U2 As Integer, U3 As Long, U4 As Integer
Dim U5 As Integer, U6 As Long, U7 As Integer
Dim stop1 As Integer, stop2 As Integer, stop3 As Integer, stop4 As Integer, stop5 As Integer
Dim open1 As Integer, open2 As Integer
If Val("&h" & (Mid(aaa, 10, 1))) And 2 ^ 2 Then stop1 = 4 Else stop1 = 0
If Val("&h" & (Mid(aaa, 10, 1))) And 2 ^ 3 Then stop2 = 8 Else stop2 = 0
If Val("&h" & (Mid(aaa, 9, 1))) And 1 Then stop3 = 1 Else stop3 = 0
If Val("&h" & (Mid(aaa, 9, 1))) And 2 Then stop4 = 2 Else stop4 = 0
If Val("&h" & (Mid(aaa, 9, 1))) And 4 Then stop5 = 8 Else stop5 = 0
If Val("&h" & (Mid(aaa, 4, 1))) And 4 Then open1 = 4 Else open1 = 0
If Val("&h" & (Mid(aaa, 4, 1))) And 8 Then open2 = 8 Else open2 = 0
If A >= 0 And A <= 3 Then U1 = 2 ^ A Else U1 = 0
If A >= 4 And A <= 7 Then U2 = 2 ^ (A - 4) Else U2 = 0
If A >= 8 And A <= 11 Then U3 = 2 ^ (A - 8) Else U3 = 0
If A >= 12 And A <= 15 Then U4 = 2 ^ (A - 12) Else U4 = 0
If A >= 16 And A <= 19 Then U5 = 2 ^ (A - 16) Else U5 = 0
If A >= 20 And A <= 23 Then U6 = 2 ^ (A - 20) Else U6 = 0
If A >= 24 And A <= 27 Then U7 = 2 ^ (A - 24) Else U7 = 0
If A >= 28 And A <= 31 Then U8 = 2 ^ (A - 28) Else U8 = 0
Text1.Text = "X " & Hex(U8) & Hex(U7 + open1 + open2) & Hex(U6) & Hex(U5) & Hex(U4) & Hex(U3) & Hex(U2 + stop5 + stop4 + stop3) & Hex(U1 + stop2 + stop1) & " Y " & "00000000"
If Val("&h" & (Mid(aaa, 16, 1))) And 2 ^ 2 And Picture1.Top > 0 Then Picture1.Top = Picture1.Top - 9 'Line5.Y2 = Picture1.Top
If Val("&h" & (Mid(aaa, 16, 1))) And 2 ^ 3 And Picture1.Top < 7320 Then Picture1.Top = Picture1.Top + 9 'And Line6.Y2 = Picture1.Top
If Val("&h" & (Mid(aaa, 15, 1))) And 2 ^ 0 And Command5.Left > -1800 Then Command5.Left = Command5.Left - 30
If Val("&h" & (Mid(aaa, 15, 1))) And 2 ^ 0 And Command6.Left > -1800 Then Command6.Left = Command6.Left - 60
If Val("&h" & (Mid(aaa, 15, 1))) And 2 ^ 1 And Command5.Left < 0 Then Command5.Left = Command5.Left + 30
If Val("&h" & (Mid(aaa, 15, 1))) And 2 ^ 1 And Command6.Left < 1800 Then Command6.Left = Command6.Left + 60
Line5.Y2 = Picture1.Top
Line6.Y2 = Picture1.Top
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Winsock1.GetData aaa
Text2.Text = aaa
If Val("&h" & (Mid(aaa, 21, 1))) And 2 ^ 0 Then Shape1(0).BackStyle = 1 Else Shape1(0).BackStyle = 0
If Val("&h" & (Mid(aaa, 21, 1))) And 2 ^ 1 Then Shape1(1).BackStyle = 1 Else Shape1(1).BackStyle = 0
If Val("&h" & (Mid(aaa, 19, 1))) And 2 ^ 1 Then Shape1(7).BackStyle = 1 Else Shape1(7).BackStyle = 0
If Val("&h" & (Mid(aaa, 19, 1))) And 2 ^ 2 Then Shape1(8).BackStyle = 1 Else Shape1(8).BackStyle = 0
If Val("&h" & (Mid(aaa, 19, 1))) And 2 ^ 3 Then Shape1(9).BackStyle = 1 Else Shape1(9).BackStyle = 0
If Val("&h" & (Mid(aaa, 18, 1))) And 2 ^ 0 Then Shape1(10).BackStyle = 1 Else Shape1(10).BackStyle = 0
If Val("&h" & (Mid(aaa, 18, 1))) And 2 ^ 1 Then Shape1(11).BackStyle = 1 Else Shape1(11).BackStyle = 0
If Val("&h" & (Mid(aaa, 18, 1))) And 2 ^ 2 Then Shape1(12).BackStyle = 1 Else Shape1(12).BackStyle = 0
If Val("&h" & (Mid(aaa, 18, 1))) And 2 ^ 3 Then Shape1(13).BackStyle = 1 Else Shape1(13).BackStyle = 0
If Val("&h" & (Mid(aaa, 17, 1))) And 2 ^ 0 Then Shape1(14).BackStyle = 1 Else Shape1(14).BackStyle = 0
If Val("&h" & (Mid(aaa, 17, 1))) And 2 ^ 1 Then Shape1(15).BackStyle = 1 Else Shape1(15).BackStyle = 0
If Val("&h" & (Mid(aaa, 17, 1))) And 2 ^ 2 Then Shape1(16).BackStyle = 1 Else Shape1(16).BackStyle = 0
If Val("&h" & (Mid(aaa, 17, 1))) And 2 ^ 3 Then Shape1(17).BackStyle = 1 Else Shape1(17).BackStyle = 0
If Val("&h" & (Mid(aaa, 16, 1))) And 2 ^ 0 Then Shape1(18).BackStyle = 1 Else Shape1(18).BackStyle = 0
If Val("&h" & (Mid(aaa, 16, 1))) And 2 ^ 1 Then Shape1(19).BackStyle = 1 Else Shape1(19).BackStyle = 0
If Val("&h" & (Mid(aaa, 21, 1))) And 2 ^ 2 Then Shape2(0).BackStyle = 1 Else Shape2(0).BackStyle = 0
If Val("&h" & (Mid(aaa, 21, 1))) And 2 ^ 3 Then Shape2(1).BackStyle = 1 Else Shape2(1).BackStyle = 0
If Val("&h" & (Mid(aaa, 20, 1))) And 2 ^ 0 Then Shape2(2).BackStyle = 1 Else Shape2(2).BackStyle = 0
If Val("&h" & (Mid(aaa, 20, 1))) And 2 ^ 1 Then Shape2(3).BackStyle = 1 Else Shape2(3).BackStyle = 0
If Val("&h" & (Mid(aaa, 20, 1))) And 2 ^ 2 Then Shape2(4).BackStyle = 1 Else Shape2(4).BackStyle = 0
If Val("&h" & (Mid(aaa, 20, 1))) And 2 ^ 3 Then Shape2(5).BackStyle = 1 Else Shape2(5).BackStyle = 0
If Val("&h" & (Mid(aaa, 19, 1))) And 2 ^ 0 Then Shape2(6).BackStyle = 1 Else Shape2(6).BackStyle = 0
If Val("&h" & (Mid(aaa, 10, 1))) And 2 ^ 2 Then Picture1.Top = 7200
If Val("&h" & (Mid(aaa, 10, 1))) And 2 ^ 3 Then Picture1.Top = 5400
If Val("&h" & (Mid(aaa, 9, 1))) And 2 ^ 0 Then Picture1.Top = 3600
If Val("&h" & (Mid(aaa, 9, 1))) And 2 ^ 1 Then Picture1.Top = 1800
If Val("&h" & (Mid(aaa, 9, 1))) And 2 ^ 2 Then Picture1.Top = 0
'If commend5.Left = 0 And Command6.Left = 1800 Then Winsock1.SendData "X 08000000 Y 00000000"
'If Command5.Left = -1800 And Command6.Left = 3600 Then Winsock1.SendData "X 04000000 Y 00000000"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -