📄 串口测试.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4695
ClientLeft = 60
ClientTop = 345
ClientWidth = 6330
LinkTopic = "Form1"
ScaleHeight = 4695
ScaleWidth = 6330
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "结束"
Height = 495
Left = 2040
TabIndex = 6
Top = 3480
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "接收"
Height = 495
Left = 3120
TabIndex = 5
Top = 2640
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "发送"
Height = 495
Left = 1080
TabIndex = 4
Top = 2640
Width = 1095
End
Begin VB.TextBox Text2
Height = 1095
Left = 3000
TabIndex = 3
Top = 1200
Width = 1575
End
Begin VB.TextBox Text1
Height = 1095
Left = 840
TabIndex = 2
Top = 1200
Width = 1575
End
Begin MSCommLib.MSComm MSComm1
Left = 5040
Top = 360
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = -1 'True
End
Begin VB.Label Label2
Caption = "接收区"
Height = 255
Left = 3000
TabIndex = 1
Top = 960
Width = 735
End
Begin VB.Label Label1
Caption = "传送区"
Height = 255
Left = 840
TabIndex = 0
Top = 960
Width = 735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim buf$
MSComm1.Output = Trim(Text1.Text)
buf = Trim(MSComm1.Input)
If Len(buf) = 0 Then
Text2.Text = "empty"
Else
Text2.Text = buf
End If
End Sub
Private Sub Command2_Click()
Dim buf$
buf = Trim(MSComm1.Input)
If Len(buf) = 0 Then
Text2.Text = "empty"
Else
Text2.Text = buf
End If
End Sub
Private Sub Command3_Click()
MSComm1.PortOpen = False
End
End Sub
Private Sub Form_Load()
MSComm1.PortOpen = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -