📄 form1.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 8160
ClientLeft = 2520
ClientTop = 2025
ClientWidth = 9060
LinkTopic = "Form1"
ScaleHeight = 8160
ScaleWidth = 9060
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 8640
Top = 3480
End
Begin MSComctlLib.ListView ListView_Data
Height = 4095
Left = 120
TabIndex = 28
Top = 3840
Width = 8655
_ExtentX = 15266
_ExtentY = 7223
View = 3
LabelWrap = -1 'True
HideSelection = 0 'False
FlatScrollBar = -1 'True
FullRowSelect = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 4
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "从站地址"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "数据类型"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 2
Text = "刷新时间"
Object.Width = 2646
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 3
Text = "数据"
Object.Width = 14887
EndProperty
End
Begin VB.Frame Frame3
Caption = "从站设置"
Height = 1215
Left = 120
TabIndex = 19
Top = 2400
Width = 8655
Begin VB.CommandButton Command_DisSlave
Caption = "断开连接"
Height = 375
Left = 6840
TabIndex = 27
Top = 240
Width = 1215
End
Begin VB.TextBox Text_Data
Height = 375
Left = 840
TabIndex = 26
Text = "00 01 02 03 "
Top = 720
Width = 7695
End
Begin VB.CommandButton Command_Send
Caption = "发送数据"
Height = 375
Left = 5400
TabIndex = 24
Top = 240
Width = 1215
End
Begin VB.ComboBox Combo_Datatype
Height = 315
ItemData = "Form1.frx":0000
Left = 3960
List = "Form1.frx":000A
Style = 2 'Dropdown List
TabIndex = 23
Top = 280
Width = 1095
End
Begin VB.ComboBox Combo_ConSlave
Height = 315
Left = 1560
Style = 2 'Dropdown List
TabIndex = 21
Top = 280
Width = 1215
End
Begin VB.Label Label11
Caption = "数据:"
Height = 255
Left = 360
TabIndex = 25
Top = 840
Width = 495
End
Begin VB.Label Label10
Caption = "数据类型:"
Height = 255
Left = 3120
TabIndex = 22
Top = 360
Width = 855
End
Begin VB.Label Label9
Caption = "已连接从站ID:"
Height = 255
Left = 360
TabIndex = 20
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame2
Caption = "从站设置"
Height = 735
Left = 120
TabIndex = 15
Top = 1560
Width = 8655
Begin VB.CommandButton Command_ConSlave
Caption = "建立连接"
Height = 375
Left = 4680
TabIndex = 18
Top = 240
Width = 1095
End
Begin VB.ComboBox Combo_DisSlave
Height = 315
Left = 3240
Style = 2 'Dropdown List
TabIndex = 17
Top = 285
Width = 1215
End
Begin VB.Label Label8
Caption = "未连接从站ID:"
Height = 255
Left = 2040
TabIndex = 16
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "主站设置"
Height = 1335
Left = 120
TabIndex = 0
Top = 120
Width = 8655
Begin VB.CommandButton CommandStart
Caption = "启动"
Height = 375
Left = 7560
TabIndex = 14
Top = 480
Width = 855
End
Begin VB.TextBox Text_MasterCycle
Height = 310
Left = 6480
TabIndex = 12
Text = "100"
Top = 720
Width = 735
End
Begin VB.ComboBox Combo_MasterID
Height = 315
Left = 3795
Style = 2 'Dropdown List
TabIndex = 10
Top = 720
Width = 1215
End
Begin VB.ComboBox Combo_CANbaud
Height = 315
ItemData = "Form1.frx":0016
Left = 1320
List = "Form1.frx":002B
Style = 2 'Dropdown List
TabIndex = 8
Top = 720
Width = 1215
End
Begin VB.ComboBox Combo_CANind
Height = 315
ItemData = "Form1.frx":0058
Left = 6120
List = "Form1.frx":005F
Style = 2 'Dropdown List
TabIndex = 6
Top = 280
Width = 1335
End
Begin VB.ComboBox Combo_Devind
Height = 315
ItemData = "Form1.frx":0066
Left = 3800
List = "Form1.frx":0082
Style = 2 'Dropdown List
TabIndex = 4
Top = 280
Width = 1215
End
Begin VB.ComboBox Combo_Devtype
Height = 315
ItemData = "Form1.frx":009E
Left = 1320
List = "Form1.frx":00CF
Style = 2 'Dropdown List
TabIndex = 2
Top = 285
Width = 1215
End
Begin VB.Label Label7
Caption = "ms"
Height = 255
Left = 7280
TabIndex = 13
Top = 800
Width = 255
End
Begin VB.Label Label6
Caption = "定时循环周期:"
Height = 255
Left = 5280
TabIndex = 11
Top = 800
Width = 1215
End
Begin VB.Label Label5
Caption = "主站ID:"
Height = 255
Left = 3000
TabIndex = 9
Top = 800
Width = 735
End
Begin VB.Label Label4
Caption = "CAN波特率:"
Height = 255
Left = 240
TabIndex = 7
Top = 800
Width = 975
End
Begin VB.Label Label3
Caption = "CAN通道:"
Height = 255
Left = 5280
TabIndex = 5
Top = 360
Width = 855
End
Begin VB.Label Label2
Caption = "设备索引号:"
Height = 255
Left = 2760
TabIndex = 3
Top = 360
Width = 975
End
Begin VB.Label Label1
Caption = "主站设备类型:"
Height = 255
Left = 120
TabIndex = 1
Top = 360
Width = 1215
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Private Type listdata
' hslave As Long
' bai As Byte
'End Type
Dim m_cfg As ROUTECFG
Dim m_hRoute As Long
Private Sub Selcanbaud()
For i = 0 To 2
If Combo_CANbaud.ItemData(i) = m_cfg.wCANBaud Then
Combo_CANbaud.ListIndex = i
Exit For
End If
Next
End Sub
Private Sub DelAllFromList()
Dim itemx As ListItem
Dim str1 As String
ListView_Data.ListItems.Clear
Combo_DisSlave.Clear
Combo_ConSlave.Clear
wMasterID = m_cfg.wMasterID
For i = 0 To wMasterID - 1
Combo_DisSlave.AddItem (str(i))
Combo_DisSlave.ItemData(i) = i
Next
For i = wMasterID + 1 To &HFF - 1
Combo_DisSlave.AddItem (str(i))
Combo_DisSlave.ItemData(i - 1) = i
Next
Combo_DisSlave.ListIndex = 0
End Sub
Private Sub SetBtnStatus()
Command_ConSlave.Enabled = Mgr_IsStarted()
Command_Send.Enabled = Mgr_IsStarted()
Command_DisSlave.Enabled = Mgr_IsStarted()
End Sub
Private Sub AddConnectedItem(hslave As Long)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -