📄 testset.frm
字号:
VERSION 5.00
Object = "{A1FAE7E2-43E2-11D1-A2CD-0040333F065C}#5.1#0"; "McgsGrid.ocx"
Begin VB.Form TestSet
BackColor = &H8000000B&
BorderStyle = 3 'Fixed Dialog
Caption = "组态环境设备接口测试"
ClientHeight = 5145
ClientLeft = 45
ClientTop = 330
ClientWidth = 7800
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 = 5145
ScaleWidth = 7800
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.CommandButton Cmd_OK
Caption = "确认"
Height = 495
Left = 4020
TabIndex = 1
Top = 4560
Width = 1635
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 495
Left = 5940
TabIndex = 0
Top = 4560
Width = 1635
End
Begin McgsEditGrid.McgsGrid Grid1
Height = 4275
Left = 180
TabIndex = 2
Top = 180
Width = 7425
_ExtentX = 13097
_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
FocusRect = 0
HighLight = 0
MergeCells = 1
End
End
Attribute VB_Name = "TestSet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public SavObj As Object
Public DatObj As Object
Public DDevObj As Object
Public OK As Long
Dim oldrow As Long
Private Sub Cmd_Cancel_Click()
OK = 0
Unload Me
End Sub
Private Sub Cmd_OK_Click()
Dim msg As String, mmsg As String
OK = 1
For i = 1 To UBound(ObjPro)
msg = Trim$(Grid1.TextMatrix(i + 2, 2))
Select Case ObjPro(i).iType
Case -100 To 0
j = Abs(ObjPro(i).iType)
For n = 1 To UBound(EnumPro(j).iValue)
mmsg = Format$(EnumPro(j).iValue(n), "0") + " - " + EnumPro(j).strName(n)
If mmsg = msg Then
ObjPro(i).iValue = Format$(EnumPro(j).iValue(n), "0")
End If
Next n
Case Else
ObjPro(i).iValue = msg
If ObjPro(i).strName = "DevBaseIO" Then
ObjPro(i).iValue = Format$(Val("&H" + msg))
End If
End Select
Next i
Unload Me
End Sub
Private Sub Form_Load()
On Error Resume Next
Dim i As Long
For i = 0 To Me.Controls.Count - 1
Me.Controls(i).Font.Bold = False
Next i
InitGrid
End Sub
Sub InitGrid()
With Grid1
.Rows = UBound(ObjPro) + 3
For i = 1 To .Rows - 1
.RowHeight(i) = 320
.TextMatrix(i, 0) = Format$(i, "0")
Next i
.RowHeight(0) = 480
.TextMatrix(0, 0) = "序号"
.TextMatrix(0, 1) = "设备属性名"
.TextMatrix(0, 2) = "设备属性值"
.TextMatrix(0, 3) = "设备属性说明"
For i = 0 To 3
.FixedAlignment(i) = 4
.ColAlignment(i) = 1
Next i
.ColAlignment(0) = 4
.ColWidth(0) = 600
.ColWidth(1) = 1600
.ColWidth(2) = 2200
.ColWidth(3) = 3200
.col = 2: .row = 1
End With
Grid1.TextMatrix(1, 1) = "[设备帮助]"
Grid1.TextMatrix(2, 1) = "[内部属性]"
Grid1.TextMatrix(1, 3) = "查看设备在线帮助"
Grid1.TextMatrix(2, 3) = "设置设备内部属性"
For i = 1 To UBound(ObjPro)
Grid1.TextMatrix(i + 2, 1) = ObjPro(i).strName
Grid1.TextMatrix(i + 2, 3) = ObjPro(i).strNote
Select Case ObjPro(i).iType
Case -100 To 0
j = Abs(ObjPro(i).iType)
msg = ""
For n = 1 To UBound(EnumPro(j).iValue)
If EnumPro(j).iValue(n) = Val(ObjPro(i).iValue) Then
msg = Format$(EnumPro(j).iValue(n), "0") + " - " + EnumPro(j).strName(n)
End If
Next n
Grid1.TextMatrix(i + 2, 2) = msg
Case Else
Grid1.TextMatrix(i + 2, 2) = ObjPro(i).iValue
If ObjPro(i).strName = "DevBaseIO" Then
Grid1.TextMatrix(i + 2, 2) = Hex$(Val(ObjPro(i).iValue))
End If
End Select
Next i
End Sub
Private Sub Grid1_CmdClick(ByVal row As Long, ByVal col As Long)
If row = 1 Then DDevObj.GetDevHelp
If row = 2 Then DDevObj.SetDevPage SavObj
End Sub
Private Sub Grid1_EnterCell()
Grid1.col = 2
Grid1.CellBackColor = &H8000000D
Grid1.CellForeColor = &HFFFFFF
End Sub
Private Sub Grid1_LeaveCell()
Grid1.CellBackColor = 0
Grid1.CellForeColor = 0
End Sub
Private Sub Grid1_RowColChange(ByVal row As Long, ByVal col As Long, flag As Long, Dat As Variant)
Dim i As Long, j As Long, k As Long
Select Case row
Case 1, 2: flag = 2
Case Else
i = row - 2: j = ObjPro(i).iType
If j < 0 Then
flag = 1: j = -j
i = UBound(EnumPro(j).strName)
ReDim Dat(i) As String
For k = 1 To i
Dat(k) = Format$(EnumPro(j).iValue(k), "0") + " - " + EnumPro(j).strName(k)
Next k
Else
flag = 0
End If
End Select
End Sub
Private Sub Grid1_StartInput(flag As Long)
If Grid1.col = 1 Or Grid1.col = 3 Then flag = 1
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -