📄 -=
字号:
VERSION 5.00
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "Mscomm32.ocx"
Begin VB.Form MultimeterCtrol
BorderStyle = 1 'Fixed Single
Caption = "万用表设置"
ClientHeight = 1635
ClientLeft = 6330
ClientTop = 3270
ClientWidth = 3120
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1635
ScaleWidth = 3120
Begin VB.TextBox Text1
Height = 270
Left = 2520
TabIndex = 8
Text = "1"
Top = 1260
Width = 495
End
Begin VB.CommandButton Command3
Caption = "读取数据"
Height = 375
Left = 1560
TabIndex = 7
Top = 840
Width = 1455
End
Begin VB.CheckBox Check1
Caption = "计算机程控"
Height = 255
Left = 240
TabIndex = 6
Top = 1290
Width = 1215
End
Begin VB.Frame Frame1
Caption = "功能选择"
Height = 1095
Left = 120
TabIndex = 2
Top = 120
Width = 1335
Begin VB.OptionButton Option1
Caption = "电阻测量"
Height = 255
Index = 2
Left = 120
TabIndex = 5
Top = 720
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "电流测量"
Height = 255
Index = 1
Left = 120
TabIndex = 4
Top = 480
Width = 1095
End
Begin VB.OptionButton Option1
Caption = "电压测量"
Height = 255
Index = 0
Left = 120
TabIndex = 3
Top = 240
Width = 1095
End
End
Begin VB.CommandButton Command2
Caption = "清除错误"
Height = 375
Left = 1560
TabIndex = 1
Top = 480
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "连通测试"
Height = 375
Left = 1560
TabIndex = 0
Top = 120
Width = 1455
End
Begin MSCommLib.MSComm MSComm1
Left = 2040
Top = 1800
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 2
DTREnable = -1 'True
End
Begin VB.Label Label1
Caption = "测量采样数"
Height = 255
Left = 1560
TabIndex = 9
Top = 1320
Width = 975
End
End
Attribute VB_Name = "MultimeterCtrol"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Public 万用表 As MultiMeter34401A
Private Sub Check1_Click()
Select Case Check1.Value
Case Checked
万用表.远程控制 = True
Case Unchecked
万用表.远程控制 = False
End Select
End Sub
Private Sub Command1_Click()
Dim strTemp As String
strTemp = 万用表.设备ID
If Not strTemp = "" Then
strTemp = "设备" & vbCrLf & _
strTemp & vbCrLf & _
"正常连接"
Else
strTemp = "万用表连接失败" & vbCrLf & "请检查Com1连接是否正确连接到万用表上"
End If
MsgBox strTemp, vbInformation, "万用表连接状况"
End Sub
Private Sub Command2_Click()
MsgBox 万用表.故障清除, , "万用表故障信息"
End Sub
Private Sub Command3_Click()
Dim sngTemp As Single
sngTemp = 万用表.读取测试数据
MsgBox sngTemp, vbInformation, "测试数据"
End Sub
Private Sub Form_Load()
Set 万用表 = New MultiMeter34401A
Set 万用表.端口 = MSComm1
Option1(0).Value = True
Check1.Value = Checked
End Sub
Private Sub Form_Unload(Cancel As Integer)
Check1.Value = Unchecked
Set 万用表 = Nothing
End Sub
Private Sub Option1_Click(Index As Integer)
万用表.测试类型 = Index + 1
万用表.采样数 = 1
Text1.Text = 1
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 13
设置采样数
Command3.SetFocus
End Select
End Sub
Private Sub Text1_LostFocus()
设置采样数
End Sub
Private Sub 设置采样数()
Dim intTemp As Integer
On Error GoTo errLine:
With Text1
intTemp = CInt(.Text)
End With
万用表.采样数 = intTemp
Exit Sub
errLine:
Select Case Err.Number
Case 13
Text1.Text = "错误!"
End Select
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -