📄 form1.frm
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "计算"
ClientHeight = 3150
ClientLeft = 45
ClientTop = 330
ClientWidth = 2910
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3150
ScaleWidth = 2910
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "清空"
Height = 375
Left = 2040
TabIndex = 1
Top = 2640
Width = 615
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 500
Left = 1560
Top = 0
End
Begin VB.TextBox Text1
Height = 2295
IMEMode = 2 'OFF
Left = 1080
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Text = "Form1.frx":0000
Top = 240
Width = 1575
End
Begin MSCommLib.MSComm MSComm1
Left = 2040
Top = 0
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
DTREnable = 0 'False
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim ff As Double
Private Sub Command2_Click()
Text1.Text = ""
End Sub
Private Sub Form_Load()
Text1.Text = ""
MSComm1.CommPort = 1 'COM2
MSComm1.Settings = "115200,n,8,1" '"9600,n,8,1"
MSComm1.RThreshold = 1
MSComm1.SThreshold = 1
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
m_hSend = False
Dim temp As Double
Dim temp1 As Double
Dim temp2 As String
If MSComm1.CommEvent = 2 Then
If ff = 0 Then
ff = Val(MSComm1.Input)
Else
temp = Val(MSComm1.Input)
temp1 = temp + ff '数字相加结果
temp2 = temp1 + "0" '数字相加结果 转为字符串类型
Text1.Text = Text1.Text & ff & vbCrLf & temp & vbCrLf & "---" & temp1 & vbCrLf
MSComm1.Output = temp2
ff = 0
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -