📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5310
ClientLeft = 3405
ClientTop = 3960
ClientWidth = 8490
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 5310
ScaleWidth = 8490
Begin VB.CommandButton Command6
Caption = "帮朋友做下广告"
Height = 375
Left = 480
TabIndex = 13
Top = 4560
Width = 4815
End
Begin VB.Timer Timer1
Interval = 16000
Left = 5640
Top = 4320
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2775
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 11
Top = 1320
Width = 5295
End
Begin VB.CheckBox Check1
Caption = "发送时间"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6120
TabIndex = 8
Top = 3600
Width = 1335
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 6240
TabIndex = 7
Text = "COM1"
Top = 480
Width = 975
End
Begin MSComDlg.CommonDialog CDialog1
Left = 5160
Top = 720
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command3
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6480
TabIndex = 4
Top = 4320
Width = 975
End
Begin VB.Frame Frame2
Caption = "串口/字体选择"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 6120
TabIndex = 3
Top = 240
Width = 2295
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 1200
TabIndex = 12
Text = "宋体"
Top = 240
Width = 975
End
End
Begin VB.CommandButton Command2
BackColor = &H80000010&
Caption = "清除"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 1
Top = 240
Width = 975
End
Begin VB.CommandButton Command1
BackColor = &H80000010&
Caption = "发送"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3240
TabIndex = 0
Top = 840
Width = 975
End
Begin MSCommLib.MSComm MSComm1
Left = 4560
Top = 240
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
OutBufferSize = 1024
End
Begin VB.Frame Frame1
Caption = "发送"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4095
Left = 120
TabIndex = 2
Top = 120
Width = 5655
Begin VB.CommandButton Command4
Caption = "打开"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 10
Top = 120
Width = 975
End
Begin VB.CommandButton Command5
Caption = "保存"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 9
Top = 720
Width = 975
End
Begin VB.Label Label4
Caption = "发送字长:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 6
Top = 720
Width = 855
End
Begin VB.Label Label3
Caption = "Label3"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1080
TabIndex = 5
Top = 720
Width = 735
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mypath1 '文件所在的文件夹
Dim zitipath '字体所在路径
'Dim Rec(512) As Integer
Dim n As Integer '文本计数用hzLen()
Dim hzstr1() As String '从文本中取出的中文存放的一个数组
Dim jnmstr() '存储机内码
'Dim qwm '存储区位码
Dim address1 '存放在hzk16中的地址
Dim zmhp() As Byte '定义横排字存放的树组
Dim zmsp() As Byte '定义竖排字存放的数组
'Private Sub Check1_Click()
'Call subsendtime
'Else
'Timer1.Enabled = False
'End Sub
Private Sub Combo2_Click() '文本框字体控制
If Combo2.Text = "宋体" Then Text1.Font = "宋体"
If Combo2.Text = "仿宋" Then Text1.Font = "仿宋_GB2312"
If Combo2.Text = "楷体" Then Text1.Font = "楷体_GB2312"
If Combo2.Text = "黑体" Then Text1.Font = "黑体"
End Sub
'Dim t3 As Integer
Private Sub Command1_Click() '发送
If Text1.Text = "" Then
X = MsgBox("发送数据不能为空", 16)
End If
On Error Resume Next
Call hzLenandstore '统计出文本中字符串的长度
Call Subchange1 '把汉字从字库中取出来并横排存放在数组zmhp()
Call subchange2 '将横排汉字转换为竖排存放
'Label3.Caption = n
'******************************************
'Dim send1 As Byte
'For i = 1 To n
'For j = 1 To 32
'send1 = zmhp(i, j)
'MSComm1.Output = zmhp(i, j)
'Debug.Print Hex(zmhp(i, j)) & "H,";
'Next j
'Debug.Print "/*"; hzstr1(i); "*/"
'Debug.Print Chr(13)
'Next i
'Dim send1 As Byte
'**********************************************打开端口号控制部分*
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
Dim port 'As Integer
If Combo1.Text = "COM1" Then port = 1
If Combo1.Text = "COM2" Then port = 2
If Combo1.Text = "COM3" Then port = 3
If Combo1.Text = "COM4" Then port = 4
MSComm1.CommPort = port
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True '判断串口是否打开
'***********************************************字体控制部分***
If Combo2.Text = "宋体" Then zitipahth = mypath1 & "hzk16"
If Combo2.Text = "仿宋" Then zitipahth = mypath1 & "hzk16f"
If Combo2.Text = "楷体" Then zitipahth = mypath1 & "hzk16"
If Combo2.Text = "黑体" Then zitipahth = mypath1 & "hzk16"
'****************************************************
'***************************************横排发送*********
Dim send1(1 To 1024) As Byte '定义要发送的数组.
Dim m As Integer
'Debug.Print
send1(1) = CByte(n)
send1(2) = CByte(n)
send1(3) = CByte(n) '发送要输出字的长度,便于单片机控制屏幕显示,此为长度控制,在单片中的存放位置为text[1]
send1(4) = n
For i = 5 To 1024 '采用固定字节发送,
send1(i) = CByte(&H0) '给要发送的定字长所有数据先清0
Next i
m = 33 '根据屏幕的大小给出要发送字的起始位置
'MSComm1.OutBufferCount = 0
'MSComm1.Output = CByte(n)
For i = 1 To n
For j = 1 To 32
send1(m) = zmsp(i, j) '把要发送的字的字模按字的先后存入一个数组里
'MSComm1.Output = zmhp(i, j) '发送数据
'Debug.Print "&H"; Hex(zmsp(i, j)) & ",";
'Debug.Print Hex(send1(m)) & "H,";
m = m + 1
Next j
'MSComm1.Output = send1
'Debug.Print "/*"; hzstr1(i); "*/"
'Debug.Print Chr(13)
Next i
MSComm1.OutBufferCount = 0 '发送缓冲区清空
MSComm1.Output = send1() '将数据发送个单片机
End Sub
Private Sub Command2_Click() '清除
Text1.Text = ""
End Sub
Private Sub Command3_Click() '退出
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -