?? testrun.frm
字號:
VERSION 5.00
Object = "{A1FAE7E2-43E2-11D1-A2CD-0040333F065C}#5.1#0"; "McgsGrid.ocx"
Begin VB.Form TestRun
BorderStyle = 3 'Fixed Dialog
Caption = "運行環境設備接口測試"
ClientHeight = 5160
ClientLeft = 45
ClientTop = 330
ClientWidth = 5535
BeginProperty Font
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5160
ScaleWidth = 5535
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Timer Timer1
Interval = 1000
Left = 4200
Top = 0
End
Begin McgsEditGrid.McgsGrid Grid1
Height = 4275
Left = 180
TabIndex = 3
Top = 240
Width = 5175
_ExtentX = 9128
_ExtentY = 7541
Cols = 4
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "System"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ScrollBars = 2
End
Begin VB.CommandButton Cmd_Order
Caption = "設備命令[&M]"
Height = 435
Left = 240
TabIndex = 2
Top = 4620
Width = 1575
End
Begin VB.CommandButton Cmd_Collect
Caption = "采集數據[&C]"
Height = 435
Left = 1980
TabIndex = 1
Top = 4620
Width = 1575
End
Begin VB.CommandButton Cmd_Exit
Caption = "退出[&X]"
Height = 435
Left = 3720
TabIndex = 0
Top = 4620
Width = 1635
End
End
Attribute VB_Name = "TestRun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public DatObj As Object
Public DDevObj As Object
Dim ChlN As Long
Dim Dat() As Single
Dim DatT() As Long
Dim DatS() As String
Private Sub Cmd_Collect_Click()
GetOutDat
i% = DDevObj.CollectDevDat(DatT, Dat, msg)
Select Case i%
Case -1: MsgBox "設備工作不正常!", 48, "注 意"
Case 0: DisInputDat
Case 1: DisAllDat
Case 2: MsgBox "設備沒有有效的數據返回!", 48, "注 意"
Case Else
End Select
End Sub
Private Sub Cmd_Exit_Click()
Unload Me
End Sub
Private Sub Cmd_Order_Click()
aa$ = InputBox("請輸入設備命令:", 設備命令, "")
aa$ = Trim$(aa$)
If aa$ = "" Then Exit Sub
i% = DDevObj.RunDevCommand(DatObj, aa$)
Select Case i%
Case 0: aa$ = "設備命令" + aa$ + "正確執行!"
Case 1: aa$ = "設備命令" + aa$ + "執行錯誤!"
Case Else: aa$ = "設備命令" + aa$ + "無效!"
End Select
MsgBox aa$, 48, "注 意"
End Sub
Private Sub Form_Load()
On Error Resume Next
For i% = 0 To Me.Controls.Count - 1
Me.Controls(i%).Font.Bold = False
Next i%
ChlN = DDevObj.DevChannel
ReDim Dat(ChlN - 1), DatT(ChlN - 1), DatS(ChlN - 1)
DDevObj.GetChlType DatT(), DatS
InitGrid
End Sub
Sub InitGrid()
With Grid1
.Rows = ChlN + 1
For i% = 1 To .Rows - 1
.RowHeight(i%) = 320
.TextMatrix(i%, 0) = Format$(i%, "0000")
Next i%
.RowHeight(0) = 420
.TextMatrix(0, 0) = "通道"
.TextMatrix(0, 1) = "數據類型"
.TextMatrix(0, 2) = "通道類型"
.TextMatrix(0, 3) = "對應值"
For i% = 0 To 3
.FixedAlignment(i%) = 4
.ColAlignment(i%) = 4
Next i%
.ColWidth(0) = 680
.ColWidth(1) = 1200
.ColWidth(2) = 1800
.ColWidth(3) = 1200
.col = 0: .row = 0
For i% = 0 To ChlN - 1
.TextMatrix(i% + 1, 1) = Format$(DatT(i%))
.TextMatrix(i% + 1, 2) = DatS(i%)
Next i%
End With
End Sub
'顯示采集進來得數據,包括輸出通道的數據
Sub DisAllDat()
For i% = 0 To ChlN - 1
fmt$ = "0"
If DatS(i) = "基準時鐘" Then fmt$ = "0.000"
If DatS(i) = "頻率測量" Then fmt$ = "0.00"
Grid1.TextMatrix(i% + 1, 3) = Format$(Dat(i%), fmt$)
Next i%
End Sub
'只顯示采集進來的輸入通道的數據
Sub DisInputDat()
For i% = 0 To ChlN - 1
If DatT(i%) > 0 Then Grid1.TextMatrix(i% + 1, 3) = Format$(Dat(i%), "0.000")
Next i%
End Sub
'讀取輸出通道的數據
Sub GetOutDat()
For i% = 0 To ChlN - 1
If DatT(i%) < 0 Then Dat(i%) = Val(Grid1.TextMatrix(i% + 1, 3))
Next i%
End Sub
Private Sub Grid1_StartInput(flag As Long)
flag = 1
If Grid1.col = 3 And DatT(Grid1.row - 1) < 0 Then flag = 0
End Sub
Private Sub Timer1_Timer()
'Cmd_Collect_Click
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -