📄 canbus.frm
字号:
Width = 2520
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "设备返回字符串以字符(ASCII码) 开始,以字符(ASCII码) 结束。"
Height = 180
Index = 3
Left = 60
TabIndex = 20
Top = 900
Width = 6210
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "命令字符串"
Height = 180
Index = 2
Left = 60
TabIndex = 19
Top = 577
Width = 900
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "设备编号"
Height = 180
Index = 1
Left = 3210
TabIndex = 17
Top = 210
Width = 720
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "接口编号"
Height = 180
Index = 0
Left = 1350
TabIndex = 15
Top = 210
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "命令号"
Height = 180
Left = 60
TabIndex = 13
Top = 210
Width = 540
End
End
Begin VB.Frame Frame1
Height = 585
Left = 180
TabIndex = 0
Top = 150
Width = 12105
Begin VB.CommandButton Command1
Caption = "打开串口"
Height = 315
Left = 9780
TabIndex = 11
Top = 120
Width = 1185
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "CANBus.frx":0990
Left = 750
List = "CANBus.frx":09AF
TabIndex = 5
Text = "Com1"
Top = 150
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "CANBus.frx":09E9
Left = 2640
List = "CANBus.frx":0A11
TabIndex = 4
Text = "9600"
Top = 150
Width = 1215
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "CANBus.frx":0A62
Left = 4530
List = "CANBus.frx":0A6F
TabIndex = 3
Text = "NONE"
Top = 150
Width = 1215
End
Begin VB.ComboBox Combo4
Height = 300
ItemData = "CANBus.frx":0A84
Left = 7080
List = "CANBus.frx":0A91
TabIndex = 2
Text = "8"
Top = 1320
Width = 1215
End
Begin VB.ComboBox Combo5
Height = 300
ItemData = "CANBus.frx":0A9E
Left = 8340
List = "CANBus.frx":0AA8
TabIndex = 1
Text = "1"
Top = 150
Width = 1215
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "通讯口"
Height = 180
Left = 120
TabIndex = 10
Top = 210
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "波特率"
Height = 180
Left = 2010
TabIndex = 9
Top = 210
Width = 540
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "校验位"
Height = 180
Left = 3900
TabIndex = 8
Top = 210
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "数据位"
Height = 180
Left = 5820
TabIndex = 7
Top = 210
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "停止位"
Height = 180
Left = 7710
TabIndex = 6
Top = 210
Width = 540
End
End
Begin MSAdodcLib.Adodc Adodc3
Height = 735
Left = 0
Top = 0
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 1296
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc4
Height = 735
Left = 1590
Top = -30
Visible = 0 'False
Width = 1455
_ExtentX = 2566
_ExtentY = 1296
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Image Image1
Height = 225
Left = 30
Picture = "CANBus.frx":0AB2
Stretch = -1 'True
ToolTipText = "单击置顶"
Top = 8220
Width = 345
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check2_Click()
If Check2.Value = 1 Then
Check2.Caption = "字符转为十六进制ASCII"
For i = 0 To 35
If Len(Trim(Text3(i).Text)) > 0 Then
Text3(i).Text = HextoStr(UCase(Trim(Text3(i).Text)))
End If
Next
Else
For i = 0 To 35
If Len(Trim(Text3(i).Text)) > 0 Then
Text3(i).Text = Hex(Asc(Trim(Text3(i).Text)))
End If
Next
Check2.Caption = "十六进制ASCII转为字符"
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = 1 Then
Text12.Visible = True
Text13.Visible = True
Else
Text12.Visible = False
Text13.Visible = False
End If
End Sub
Private Sub Check6_Click()
If Check6.Value = 1 Then
Check6.Caption = "字符转为十进制ASCII"
For i = 0 To 35
If Len(Trim(Text3(i).Text)) > 0 Then
'sendstring = sendstring + HextoStr(UCase(Trim(Text3(i).Text)))
Text3(i).Text = Trim(Chr$(Val(Trim(Text3(i).Text))))
End If
Next
Else
For i = 0 To 35
If Len(Trim(Text3(i).Text)) > 0 Then
Text3(i).Text = Trim(Str(Asc(Trim(Text3(i).Text))))
End If
Next
Check6.Caption = "十进制ASCII转为字符"
End If
End Sub
Private Sub Check8_Click()
If Check8.Value = 1 Then
List1.Top = 0
List1.Left = 0
List1.Height = 5600 * 2
List1.Width = 14585
Check8.Left = 14585 + 20
Else
List1.Top = 3120
List1.Left = 120
Check8.Left = 11190
List1.Height = Me.Height - 1300
List1.Width = Me.Width
End If
End Sub
Private Sub Combo6_Change()
For i = 0 To 8
Label7(i).Visible = False
Next
Label7(2).Caption = "命令字符串"
Text1.Visible = False
Text2.Visible = False
Text4.Visible = False
Text5.Visible = False
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text12.Visible = False
Text13.Visible = False
Combo7.Visible = False
Combo8.Visible = False
Combo9.Visible = False
Combo10.Visible = False
Check1.Visible = False
Check7.Visible = False
Command6.Visible = False
Command7.Visible = False
Command8.Visible = False
Command9.Visible = False
Command10.Visible = False
For i = 0 To 35
Text3(i).Visible = False
Next
Text10.Visible = False
Text11.Visible = False
Select Case Trim(Combo6.Text)
Case 1
For i = 0 To 8
Label7(i).Visible = True
Next
Text1.Visible = True
Text2.Visible = True
For i = 0 To 35
Text3(i).Visible = True
Next
Text4.Visible = True
Text5.Visible = True
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -