📄 form3.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form3
BorderStyle = 3 'Fixed Dialog
Caption = "添加项目"
ClientHeight = 6465
ClientLeft = 4935
ClientTop = 2775
ClientWidth = 6585
Icon = "Form3.frx":0000
LinkTopic = "Form3"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6465
ScaleWidth = 6585
ShowInTaskbar = 0 'False
Begin VB.ListBox List1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5100
Left = 2760
TabIndex = 4
Top = 840
Width = 3735
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 3
Top = 60
Width = 5055
End
Begin VB.CommandButton Command2
Caption = "退 出"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5520
TabIndex = 2
Top = 6030
Width = 975
End
Begin VB.CommandButton Command1
Caption = "加 入"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4320
TabIndex = 1
Top = 6030
Width = 975
End
Begin MSComctlLib.TreeView TreeView1
Height = 5130
Left = 75
TabIndex = 0
Top = 840
Width = 2580
_ExtentX = 4551
_ExtentY = 9049
_Version = 393217
LineStyle = 1
Style = 7
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "变量列表"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 240
Left = 2760
TabIndex = 7
Top = 530
Width = 960
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "变量浏览器"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 240
Left = 120
TabIndex = 6
Top = 530
Width = 1200
End
Begin VB.Label Label1
Caption = "项目名称:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 120
TabIndex = 5
Top = 120
Width = 1335
End
End
Attribute VB_Name = "Form3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim name As String
Dim ID, dType As Integer
Dim ret As Integer
Dim newliang, oldliang As String
Dim lenth, geshu, i As Integer
Dim result As Boolean
name = Text1.Text
If name = "" Then
MsgBox "项目名为空,请选择一个项目名", 48, "警告"
Exit Sub
End If
ret = AddTag(name, ID, dType)
If ret <> 0 Then
MsgBox "加入变量名时出错,错误号=" + Str(ret), 48, "错误"
End If
TagNo = ID
Form2.MSHFlexGrid1.Rows = TagNo + 2
Typ(ID - 1) = dType
'添加名称到from2
geshu = Form2.List1.ListCount
lenth = InStr(name, ".")
newliang = Left(name, lenth - 1)
For i = 1 To geshu
oldliang = Form2.List1.List(i - 1)
If oldliang = newliang Then
result = True
Exit For
End If
Next i
If result = False Then
Form2.List1.AddItem newliang
End If
result = False
Form2.MSHFlexGrid1.TextMatrix(TagNo, 0) = Str(TagNo)
Form2.MSHFlexGrid1.TextMatrix(TagNo, 1) = name
Select Case dType
Case 11
Form2.MSHFlexGrid1.TextMatrix(TagNo, 2) = "VT_BOOL"
Case 3
Form2.MSHFlexGrid1.TextMatrix(TagNo, 2) = "VT_LONG"
Case 4
Form2.MSHFlexGrid1.TextMatrix(TagNo, 2) = "VT_FLOAT"
Case 8
Form2.MSHFlexGrid1.TextMatrix(TagNo, 2) = "VT_STR"
Case Else
Form2.MSHFlexGrid1.TextMatrix(TagNo, 2) = "无效类型"
End Select
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim ret As Integer
Dim result As Integer
Dim i As Integer
Dim tagname As String * 255
ret = ReadItemNo()
TreeView1.Nodes.Clear
JieDian = 0
For i = 0 To ret - 1 Step 1
result = GetItemNames(tagname, i)
If result <> 0 Then
MsgBox "获取项目名失败,错误号=" + Str(result), 48, "错误"
Exit Sub
End If
List1.AddItem (tagname)
'Getdata (tagname)
AddNodes (tagname)
Next i
End Sub
Private Sub List1_Click()
Text1.Text = List1.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -