📄 vbys.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "KY系列智能(彩色)液晶终端(北京金创业科技开发中心)"
ClientHeight = 5655
ClientLeft = 165
ClientTop = 450
ClientWidth = 8175
LinkTopic = "Form1"
ScaleHeight = 5655
ScaleWidth = 8175
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "触摸屏测试"
Height = 1335
Left = 360
TabIndex = 15
Top = 3000
Width = 7455
Begin VB.CommandButton Command14
Caption = "对于配接KY-P系列触摸屏的终端,按此可显示触摸屏发出的数据。"
Height = 375
Left = 240
TabIndex = 16
Top = 360
Width = 6975
End
Begin VB.Label Label2
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "Label28686876876"
ForeColor = &H80000008&
Height = 255
Left = 240
TabIndex = 17
Top = 840
Width = 6975
End
End
Begin VB.CommandButton Command13
Caption = "对于全汉字终端,显示16区的前5个汉字(B0H,A1H,B0H,A2H,B0H,A3H,B0H,A4H,B0H,A5H)"
Height = 375
Left = 360
TabIndex = 14
Top = 2400
Width = 7455
End
Begin VB.CommandButton Command12
Caption = "显示字符集4的5个汉字(80H,81H,82H,83H,84H)"
Height = 375
Left = 360
TabIndex = 13
Top = 1920
Width = 7455
End
Begin VB.CommandButton Command11
Caption = "显示字符集3的5个汉字(80H,81H,82H,83H,84H)"
Height = 375
Left = 360
TabIndex = 12
Top = 1440
Width = 7455
End
Begin VB.CommandButton Command10
Caption = "清屏为蓝色"
Height = 495
Left = 360
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.CommandButton Command9
Caption = "显示字符"
Height = 495
Left = 1920
TabIndex = 3
Top = 840
Width = 1215
End
Begin VB.CommandButton Command8
Caption = "动态花屏"
Height = 495
Left = 3480
TabIndex = 5
Top = 840
Width = 1215
End
Begin VB.CommandButton Command7
Caption = "显示字符集4"
Height = 495
Left = 5040
TabIndex = 7
Top = 840
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "清屏为黑色"
Height = 495
Left = 360
TabIndex = 0
Top = 240
Width = 1215
End
Begin VB.CommandButton Command5
Caption = "显示点线圆"
Height = 495
Left = 1920
TabIndex = 2
Top = 240
Width = 1215
End
Begin VB.CommandButton Command4
Caption = "显示BMP图象"
Height = 495
Left = 3480
TabIndex = 4
Top = 240
Width = 1215
End
Begin VB.Frame Frame1
Caption = "北京金创业科技 www.jkj.com.cn (VBYS Ver2.1)"
Height = 855
Left = 360
TabIndex = 10
Top = 4560
Width = 7455
Begin VB.CommandButton Command15
Caption = "COM2"
Height = 375
Left = 2880
TabIndex = 18
Top = 240
Width = 615
End
Begin VB.Label Label1
Caption = "本软件与KY系列终端配合,由串口 以9600Hz的波特率与终端和触摸屏控制器通讯"
Height = 255
Left = 240
TabIndex = 11
Top = 360
Width = 6975
End
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 495
Left = 6600
TabIndex = 9
Top = 840
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "显示16区汉字"
Height = 495
Left = 6600
TabIndex = 8
Top = 240
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "显示字符集3"
Height = 495
Left = 5040
TabIndex = 6
Top = 240
Width = 1215
End
Begin MSCommLib.MSComm MSComm1
Left = 7680
Top = 2040
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = 0 'False
Handshaking = 2
ParitySetting = 2
InputMode = 1
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim DKCMP As Boolean
Private Sub Command1_Click()
SC1ZJ (&H1B) '显示字符集3
SC1ZJ (Asc("k"))
SC1ZJ (&HA3)
End Sub
Private Sub Command10_Click() '清蓝屏
SC1ZJ (&H1B)
SC1ZJ (&H51)
SC1ZJ (1)
End Sub
Private Sub Command11_Click()
'显示字符集3的汉字80H,...84H,本命令只对普通型终端(配448个用户自修改汉字)有效.
SC1ZJ (&H1B) '选择字符集3
SC1ZJ (&H33)
SC1ZJ (&H80) '汉字代码
SC1ZJ (&H81)
SC1ZJ (&H82)
SC1ZJ (&H83)
SC1ZJ (&H84)
End Sub
Private Sub Command12_Click()
'显示字符集4的汉字80H,...84H,本命令只对普通型终端(配448个用户自修改汉字)有效.
SC1ZJ (&H1B) '选择字符集4
SC1ZJ (&H34)
SC1ZJ (&H80) '汉字代码
SC1ZJ (&H81)
SC1ZJ (&H82)
SC1ZJ (&H83)
SC1ZJ (&H84)
End Sub
Private Sub Command13_Click()
'显示16区前5个汉字,本命令只对全汉字型终端(配国标一,二级汉字6768个)有效.
'本命令对普通型终端(配448个用户自修改汉字)执行时,显示当前字符集的字符.(代码为B0H,A1H,B0H,A2H....)
SC1ZJ (&HB0) '区码+A0H(例:16区=16+A0H=B0H)
SC1ZJ (&HA1) '位码+A0H(例:第1字=1+A0H=A1H)
SC1ZJ (&HB0) '区码+A0H(例:16区=16+A0H=B0H)
SC1ZJ (&HA2) '位码+A0H(例:第2字=2+A0H=A2H)
SC1ZJ (&HB0) '...
SC1ZJ (&HA3)
SC1ZJ (&HB0)
SC1ZJ (&HA4)
SC1ZJ (&HB0)
SC1ZJ (&HA5)
End Sub
Private Sub Command15_Click()
If Command15.Caption = "COM2" Then
MSComm1.PortOpen = False
MSComm1.CommPort = 1
MSComm1.PortOpen = True
MSComm1.Settings = "9600,s,8,1"
Command15.Caption = "COM1"
Else
MSComm1.PortOpen = False
MSComm1.CommPort = 2
MSComm1.PortOpen = True
MSComm1.Settings = "9600,s,8,1"
Command15.Caption = "COM2"
End If
End Sub
Private Sub Command2_Click()
SC1ZJ (&H1B) '显示16区汉字
SC1ZJ (Asc("k"))
SC1ZJ (16)
End Sub
Private Sub Command3_Click() '退出
End
End Sub
Private Sub Command4_Click() '显示BMP图象
Dim wjcd, i As Long
Open App.Path & "\25640d.bmp" For Binary As #2
wjcd = LOF(2)
ReDim bybuf(1 To LOF(2)) As Byte
Get #2, , bybuf()
Close #2
SC1ZJ (&H1D)
SC1ZJ (&H42)
For i = 1 To wjcd '发送全部数据
SC1ZJ (bybuf(i))
Next i
End Sub
Private Sub Command5_Click()
SC1ZJ (&H1B) '矩形
SC1ZJ (&H6A)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (127)
SC1ZJ (0)
SC1ZJ (63)
SC1ZJ (&H1B) '圆
SC1ZJ (&H79)
SC1ZJ (0)
SC1ZJ (64)
SC1ZJ (0)
SC1ZJ (32)
SC1ZJ (26)
SC1ZJ (&H1B) '点
SC1ZJ (Asc("d"))
SC1ZJ (0)
SC1ZJ (14)
SC1ZJ (0)
SC1ZJ (42)
SC1ZJ (&H1B) '线
SC1ZJ (Asc("x"))
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (0)
SC1ZJ (127)
SC1ZJ (0)
SC1ZJ (63)
End Sub
Private Sub Command6_Click()
SC1ZJ (&H1B)
SC1ZJ (&H51)
SC1ZJ (0)
End Sub
Private Sub Command7_Click()
SC1ZJ (&H1B) '显示字符集4
SC1ZJ (Asc("k"))
SC1ZJ (&HA4)
End Sub
Private Sub Command8_Click()
Dim X, y As Integer
For i = 0 To 5000
X = Rnd() * 319
y = Rnd() * 239
SC1ZJ (&H1B) '点
SC1ZJ (Asc("d"))
SC1ZJ (X \ 256 Or &HF0)
SC1ZJ (X And &HFF)
SC1ZJ (0)
SC1ZJ (y)
Next i
SC1ZJ (&H1B)
SC1ZJ (&H31)
SC1ZJ (Asc("E"))
SC1ZJ (Asc("N"))
SC1ZJ (Asc("D"))
End Sub
Private Sub Command9_Click()
'显示英文
SC1ZJ (&H1B)
SC1ZJ (&H31)
SC1ZJ (Asc("A"))
SC1ZJ (Asc("B"))
SC1ZJ (Asc("C"))
SC1ZJ (13)
SC1ZJ (10)
SC1ZJ (&H1B)
SC1ZJ (&H33)
SC1ZJ (&H80)
SC1ZJ (&H81)
SC1ZJ (13)
SC1ZJ (10)
End Sub
'输出1字节
Public Sub SC1ZJ(B As Byte)
Dim S(0) As Byte
S(0) = B
Do Until MSComm1.CTSHolding = True '等待BUSY
Loop
MSComm1.Output = S
End Sub
Private Sub Form_Load() '主程序
Command15.Caption = "COM2"
Label2.Visible = False
Label2.Caption = ""
DKCMP = 0
MSComm1.RThreshold = 5 '收到5个字节后中断
MSComm1.InputLen = 5 '读出5个字节
MSComm1.InputMode = comInputModeBinary '输入为2进制数据
MSComm1.Handshaking = comNone
MSComm1.CommPort = 2 'COM2
MSComm1.PortOpen = True '打开串口
MSComm1.Settings = "9600,s,8,1" '串口设置
End Sub
Private Sub Command14_Click() '触摸屏测试
DKCMP = Not DKCMP
If DKCMP Then
Label2.Visible = True
'ScaleMode = 1
'FillColor = RGB(0, 0, 100) '填充一矩形
' Line (360, 840)-(8775, 6375), , B '宽:8415,高:5535
Else
Label2.Visible = False
Label2.Caption = ""
End If
End Sub
Private Sub MSComm1_OnComm() '串口接收中断
Dim i%, X%, y%
Dim buf$
Select Case MSComm1.CommEvent
'Case comEvCTS
Case comEvReceive
buf = " 触摸屏输出的数据:"
InByte = MSComm1.Input
If (InByte(0) = &HA0 Or InByte(0) = &H80) And DKCMP Then
ScaleMode = 3
For i = LBound(InByte) To UBound(InByte)
If InByte(i) > 15 Then
s1 = ""
Else
s1 = "0"
End If
buf = buf + s1 + Hex(InByte(i)) + "H" + " " 'Chr(32)
Next i
X = InByte(1) * 64 + InByte(2)
y = InByte(3) * 64 + InByte(4)
Label2.Caption = buf + " 对应的坐标:(X=" + Str$(X) + ",Y=" + Str$(y) + ")"
FillColor = RGB(255, 255, 0) '填充一矩形
X = X - &H30: y = y - &H30
'X = X * 2: Y = Y * 2
Line (X, y)-(X + 3, y + 3), , B '宽:8415,高:5535
'PSet (X, Y)
End If
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -