newproject.frm
来自「自动化测试程序」· FRM 代码 · 共 248 行
FRM
248 行
VERSION 5.00
Begin VB.Form NewProject
Caption = "新建工程"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
HasDC = 0 'False
LinkTopic = "Form2"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 2 '屏幕中心
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "NewProject.frx":0000
Left = 1680
List = "NewProject.frx":0002
TabIndex = 7
Top = 1680
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2760
TabIndex = 5
Top = 2400
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "新建(&N)"
Height = 495
Left = 480
TabIndex = 4
Top = 2400
Width = 1335
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1680
MaxLength = 3
TabIndex = 2
Top = 1200
Width = 1575
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 = 1680
TabIndex = 0
Top = 600
Width = 1575
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "规约类型:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 6
Top = 1680
Width = 1050
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "设备数量:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 3
Top = 1200
Width = 1050
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "工程名称:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 480
TabIndex = 1
Top = 600
Width = 1050
End
End
Attribute VB_Name = "NewProject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
If Me.Text1.Text = "" Then
MsgBox "请输入工程名称!", vbOKOnly, "提示"
Exit Sub
End If
If ((Me.Text2.Text = "") Or (CInt(Me.Text2.Text) = 0) Or (CInt(Me.Text2.Text) > 255)) Then
MsgBox "请输入保护数量1~255!", vbOKOnly, "提示"
Exit Sub
End If
Dim fso, MyFile
Dim fileexit As Boolean
Dim Response As String
fileexit = FileExists(App.Path & "\station\" & Me.Text1.Text & ".ini")
If fileexit Then
Response = MsgBox("工程已经存在,是否覆盖原来的工程", vbYesNo, "提示")
If Response = vbNo Then
Exit Sub
End If
End If
'全站系统配置设置
Station_name = Me.Text1.Text
Device_num = CInt(Me.Text2.Text)
Comm_Gy = Me.Combo1.ListIndex + 1
'删除原来的配置文件,重新建立
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(App.Path & "\station\" & Station_name & ".ini", True)
MyFile.Close
SaveINI "系统配置", "厂站名称", Station_name, App.Path & "\station\" & Station_name & ".ini"
SaveINI "系统配置", "设备数量", Device_num, App.Path & "\station\" & Station_name & ".ini"
SaveINI "系统配置", "规约类型", Comm_Gy, App.Path & "\station\" & Station_name & ".ini"
ReDim Dev_Addr(Device_num)
ReDim dev_type(Device_num) As String
Dim i As Integer
Dim str, str1 As String
Dim typ
str1 = GetINI("MOD_TYPE", "CLASS1", App.Path & "\config.ini")
i = InStr(1, str1, ",")
str = Mid(str1, 1, i - 1)
typ = Mid(str1, i + 1)
For i = 1 To Device_num
SaveINI "设备", "Dev" & i & "_Addr", i, App.Path & "\station\" & Station_name & ".ini"
SaveINI "设备", "Dev" & i & "_Type", str, App.Path & "\station\" & Station_name & ".ini"
Dev_Addr(i) = i
dev_type(i) = str
dev_NumToName(i) = str
Addr_NodKey(i) = i
Next i
Cur_Dev.addr = i - 1
Cur_Dev.dev_key = i - 1
Cur_Dev.dev_type = str
Cur_Dev.dev_type_num = typ
' Select_ID = str
If ProjectExist = False Then
Unload Me
frmtree.Show
frmMsgList.Show
Form1.Show
' Form1.SSTab1(0).Tab = 5
ProjectExist = True
Form1.Set_Para_Name
Form1.Set_CurTm_Dat
Form1.Set_Para
Exit Sub
End If
Unload Me
frmtree.Label7.Caption = Cur_Dev.addr
frmtree.Label2.Caption = Cur_Dev.dev_type
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim str As Variant
Dim i, j As Integer
For j = 0 To Me.Combo1.ListCount - 1
Me.Combo1.RemoveItem (0)
Next j
i = GetINI("MOD_TYPE", "Guiye_Num", App.Path & "\config.ini")
For j = 1 To i
str = GetINI("Guiye", "Guiye" & j, App.Path & "\config.ini")
Me.Combo1.AddItem (str)
Next j
Me.Combo1.Text = Me.Combo1.List(0) 'FLPS规约
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
SetModel Text2, ES_NUMBER
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?