📄 controllor.frm
字号:
VERSION 5.00
Begin VB.Form controllor
BackColor = &H8000000C&
Caption = "CTRLWND"
ClientHeight = 8190
ClientLeft = 60
ClientTop = 750
ClientWidth = 7425
LinkTopic = "Form1"
ScaleHeight = 8190
ScaleWidth = 7425
WindowState = 2 'Maximized
Begin VB.Frame Frame2
Caption = "模式选择"
Height = 1095
Left = 60
TabIndex = 4
Top = 60
Width = 3855
Begin VB.OptionButton Option2
Caption = "自动模式"
Height = 435
Left = 1980
TabIndex = 9
Top = 420
Value = -1 'True
Width = 1155
End
Begin VB.OptionButton Option1
Caption = "手动模式"
Height = 435
Left = 540
TabIndex = 8
Top = 420
Width = 1155
End
End
Begin VB.Frame Frame1
Caption = "手动模式"
Height = 6555
Left = 60
TabIndex = 0
Top = 1200
Width = 3855
Begin VB.TextBox outtext
Height = 2235
Left = 60
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 7
Top = 900
Width = 3735
End
Begin VB.TextBox intext
Height = 2235
Left = 60
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 5
Top = 4200
Width = 3735
End
Begin VB.CommandButton send
Caption = "发送"
Enabled = 0 'False
Height = 375
Left = 2640
TabIndex = 3
Top = 420
Width = 1035
End
Begin VB.TextBox output
Alignment = 1 'Right Justify
BorderStyle = 0 'None
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 1
Top = 420
Width = 1515
End
Begin VB.Label Label2
Caption = "接收数据"
Height = 315
Left = 180
TabIndex = 6
Top = 3900
Width = 795
End
Begin VB.Label Label1
Caption = "发送数据"
Height = 315
Left = 180
TabIndex = 2
Top = 480
Width = 795
End
End
Begin VB.Menu file
Caption = "&File"
WindowList = -1 'True
End
Begin VB.Menu view
Caption = "&View"
Begin VB.Menu viewershow
Caption = "Viewer"
End
End
Begin VB.Menu seriport
Caption = "&SeriPort"
Begin VB.Menu sericonn
Caption = "Connection"
End
Begin VB.Menu sericlose
Caption = "Close"
End
End
End
Attribute VB_Name = "controllor"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public state As Boolean
Private Sub Form_Load()
state = True
Load Viewer
Load sericomm
Load SignalSource
Viewer.Visible = True
sericomm.Visible = True
SignalSource.Visible = True
datapointer_in = 0
datapointer_out = 0
zerovalue = Viewer.viewerwnd.Height / 2
realtime = 0
Viewer.receiveonly.Value = 1
seriauto = True
End Sub
Private Sub Form_Resize()
If Me.WindowState = 1 Then
Viewer.Visible = False
sericomm.Visible = False
SignalSource.Visible = False
End If
If Me.WindowState = 2 Then
sericomm.Left = Me.Width - sericomm.Width - 800
sericomm.Top = Viewer.Top
SignalSource.Left = Me.Width - SignalSource.Width - 250
SignalSource.Top = Viewer.Top + 3000
Frame1.Height = Me.Height - Frame2.Top - Frame2.Height - 900
outtext.Height = Frame1.Height * 2 / 5 + 250
intext.Top = Frame1.Height * 2 / 5 + 1500
Label2.Top = intext.Top - Label2.Height
intext.Height = outtext.Height
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
state = False
Unload Viewer
Unload sericomm
Unload SignalSource
End Sub
Private Sub MSComm1_OnComm()
End Sub
Private Sub Option1_Click()
seriauto = False
End Sub
Private Sub Option2_Click()
seriauto = True
End Sub
Private Sub send_Click()
Dim temp(1) As Byte
On Error GoTo marks::
temp(0) = Fix(CInt(output.Text) / 256)
temp(1) = CInt(output.Text) Mod 256
sericomm.MSComm1.output = temp
realtime = (Timer - starttime) * 1000
outtext.Text = outtext.Text + CStr(realtime) + " " + output.Text + " "
marks::
output.Text = ""
End Sub
Private Sub sericlose_Click()
On Error GoTo serimarks::
If Seriportcomm.PortOpen = True Then
Seriportcomm.PortOpen = False
MsgBox ("ok to close")
End If
serimarks::
End Sub
Private Sub sericonn_Click()
On Error GoTo serimarks::
If Seriportcomm.PortOpen = False Then
Seriportcomm.PortOpen = True
MsgBox ("ok to open")
End If
serimarks::
End Sub
Private Sub viewershow_Click()
Viewer.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -