📄 frmsee.frm
字号:
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmsee
Caption = "监视串口"
ClientHeight = 5640
ClientLeft = 60
ClientTop = 450
ClientWidth = 9165
LinkTopic = "Form1"
ScaleHeight = 5640
ScaleWidth = 9165
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton CmdClear
Caption = "清除"
Height = 375
Left = 7560
TabIndex = 3
Top = 1560
Width = 975
End
Begin VB.CommandButton cmdExit
Caption = "退出程序"
Height = 375
Left = 7560
TabIndex = 1
Top = 2760
Width = 975
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1320
Top = 240
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin RichTextLib.RichTextBox RTBCmdLine
Height = 2760
Left = 600
TabIndex = 0
Top = 1080
Width = 6735
_ExtentX = 11880
_ExtentY = 4868
_Version = 393217
Enabled = -1 'True
ScrollBars = 3
TextRTF = $"frmsee.frx":0000
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Frame Frame2
Caption = "监视串口窗口"
Height = 3735
Left = 240
TabIndex = 2
Top = 480
Width = 8415
End
End
Attribute VB_Name = "frmsee"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CmdClear_Click()
frmsee.RTBCmdLine.Text = strTipChar
frmEdit.RTBCode.Text = ""
frmEdit.LstCode.Clear
frmsee.RTBCmdLine.SelStart = Len(Me.RTBCmdLine.Text)
End Sub
Private Sub cmdExit_Click()
Unload frmsee
End Sub
Private Sub Form_Load()
frmsee.RTBCmdLine.Text = strTipChar
End Sub
Private Sub DisplayInfor(infor) '在Command Line RichTextBox中显示信息
frmsee.RTBCmdLine.Text = Me.RTBCmdLine.Text & Chr(13) & Chr(10) & infor & _
Chr(13) & Chr(10) & strTipChar
frmsee.RTBCmdLine.SelStart = Len(Me.RTBCmdLine.Text)
End Sub
Private Sub RTBCmdLine_Keydown(KeyCode As Integer, Shift As Integer)
Dim strTemp As String
Dim curInsPos As Integer
'///////////////////////////////////////////////////////////////////////////////////
'////////////////////对于不同的输入作相应地处理///////////////////////
'////////////////////////////////////////////////////////////////////////////////////
'如果不是光标移动字符,而且光标不再最后一行,则将插入点置于行尾
If KeyCode <> vbKeyEnd And KeyCode <> vbKeyHome And _
KeyCode <> vbKeyLeft And KeyCode <> vbKeyRight And _
KeyCode <> vbKeyDown And KeyCode <> vbKeyUp And WhetherInLastLine = False Then
Me.RTBCmdLine.SelStart = Len(Me.RTBCmdLine.Text)
End If
If KeyCode = vbKeyLeft Then
'如果插入点前的字符是提示符,则不能左移
If RTBCmdLine.SelStart <> 0 Then
strTemp = Mid(Me.RTBCmdLine.Text, RTBCmdLine.SelStart, 1)
If (StrComp(strTemp, strTipChar) = 0) And (WhetherInLastLine = True) Then
If Me.RTBCmdLine.SelStart = Len(Me.RTBCmdLine.Text) Then
curInsPos = RTBCmdLine.SelStart
Me.RTBCmdLine.Text = Me.RTBCmdLine.Text & " "
Me.RTBCmdLine.SelStart = curInsPos + 1
Else
Me.RTBCmdLine.SelStart = Me.RTBCmdLine.SelStart + 1
End If
End If
End If
End If
If KeyCode = vbKeyDown Then
'下一行是最后一行,则不能移动到提示符前
End If
If KeyCode = vbKeyBack Then
'如果插入点前的字符是提示符,则不能删除
strTemp = Mid(Me.RTBCmdLine.Text, Me.RTBCmdLine.SelStart, 1)
If (StrComp(strTemp, strTipChar) <> 0) And WhetherInLastLine Then
frmsee.RTBCmdLine.Locked = False
Else
frmsee.RTBCmdLine.Locked = True
End If
Else
frmsee.RTBCmdLine.Locked = False '其他的字符则解除锁定
End If
'////////////////////////////////////////////////////////////////////
'//////////////////按下Enter键后执行命令//////////////////////
'////////////////////////////////////////////////////////////////////
If KeyCode = vbKeyReturn Then
Dim LastLine As Integer 'start Point of Last Line
Dim LenLastLine As Integer 'Length of Last Line
frmsee.RTBCmdLine.SelStart = Len(Me.RTBCmdLine.Text)
frmsee.RTBCmdLine.UpTo Chr(13), False, False
If Me.RTBCmdLine.SelStart = 0 Then '如果只有一行,则不用加3
LastLine = Me.RTBCmdLine.SelStart + 1
Else
LastLine = Me.RTBCmdLine.SelStart + 3 'lastLine为“?”起始的位置
End If
LenLastLine = Len(Me.RTBCmdLine.Text) - LastLine
CurCommand = Mid(Me.RTBCmdLine.Text, LastLine + 1, LenLastLine)
'**********************
RunCommand (CurCommand)
'**********************
frmsee.RTBCmdLine.Text = Me.RTBCmdLine.Text & strTipChar
frmsee.RTBCmdLine.SelStart = Len(Me.RTBCmdLine.Text) - 1
End If
'///////////////////////////////////////////////////////////////////////
End Sub
Private Sub tmRX_Timer()
If RXCorrectFlag Then
frmsee.tmRX.Enabled = False
RXCorrectFlag = False
RepeatCnt = 0
Else
'重发命令
frmsee.tmRX.Enabled = False
nCodeIndex = nCodeIndex - 1
RunCommand (Me.LstCode.List(nCodeIndex))
frmEdit.tmRX.Enabled = True
' RepeatCnt = RepeatCnt + 1
If RepeatCnt > 5 Then
tmRX.Enabled = False
RepeatCnt = 0
Else: RepeatCnt = RepeatCnt + 1
End If
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -