📄 form8.frm
字号:
VERSION 5.00
Begin VB.Form Form8
AutoRedraw = -1 'True
Caption = "训练样本"
ClientHeight = 4635
ClientLeft = 60
ClientTop = 345
ClientWidth = 4260
ControlBox = 0 'False
LinkTopic = "Form8"
ScaleHeight = 4635
ScaleWidth = 4260
StartUpPosition = 2 'CenterScreen
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 735
Left = 600
TabIndex = 7
Top = 480
Width = 3015
Begin VB.ComboBox Combo
Height = 315
Index = 0
Left = 0
TabIndex = 8
Top = 240
Width = 3015
End
End
Begin VB.Frame Frame1
Caption = "请输入第1组训练样本"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 2055
Left = 600
TabIndex = 2
Top = 1560
Width = 3015
Begin VB.TextBox TxtInput
Height = 495
Index = 0
Left = 1320
TabIndex = 4
Top = 240
Width = 1455
End
Begin VB.TextBox TxtOutput
Height = 495
Index = 0
Left = 1320
TabIndex = 3
Top = 1200
Width = 1455
End
Begin VB.Label Label1
Caption = "输入值1:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 240
TabIndex = 6
Top = 360
Width = 1095
End
Begin VB.Label Label2
Caption = "输出值1:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 240
TabIndex = 5
Top = 1320
Width = 975
End
End
Begin VB.CommandButton Command2
Caption = "完成"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2280
TabIndex = 1
Top = 3840
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "输入"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 3840
Width = 1215
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim i As Integer
For i = 0 To LayerNodes(1) - 1
If TxtInput(i).Text = "" Then
MsgBox "请输入第" & LTrim(Str(i + 1)) & "个输入值", vbExclamation, "!!!"
Exit Sub
End If
Next i
For i = 0 To LayerNodes(LayerNum) - 1
If TxtOutput(i).Text = "" Then
MsgBox "请输入第" & LTrim(Str(i + 1)) & "个输出值", vbExclamation, "!!!"
Exit Sub
End If
Next i
If Sample_num > 1 Then
ReDim Preserve dbI(LayerNodes(1), Sample_num)
ReDim Preserve dbO(LayerNodes(LayerNum), Sample_num)
End If
For i = 0 To LayerNodes(1) - 1
dbI(i + 1, Sample_num) = Val(TxtInput(i).Text)
'Form1.Sample.AddItem "dbI(" & LTrim(Str(i + 1)) & "," & LTrim(Sample_num) & ")=" & LTrim(Str(dbI(i + 1, Sample_num)))
TxtInput(i).Text = ""
Next i
For i = 0 To LayerNodes(LayerNum) - 1
dbO(i + 1, Sample_num) = Val(TxtOutput(i).Text)
'Form1.Sample.AddItem "dbO(" & LTrim(Str(i + 1)) & "," & LTrim(Sample_num) & ")=" & LTrim(Str(dbI(i + 1, Sample_num)))
TxtOutput(i).Text = ""
Next i
Sample_num = Sample_num + 1
Frame1.Caption = "请输入第" & LTrim(Str(Sample_num)) & "组样本"
End Sub
Private Sub Command2_Click()
Dim i As Integer
ReDim TFunctionNum(LayerNodes(LayerNum))
For i = 1 To LayerNodes(LayerNum)
TFunctionNum(i) = Combo(i - 1).ListIndex
Next i
Sample_num = Sample_num - 1
SaveFlag = True
Init
Unload Form8
Form1.Show
End Sub
Private Sub Form_Activate()
Dim i As Integer, j As Integer, n As Integer
Dim TrainFX
Set TrainFX = New FunctionDLL.TrainF
n = TrainFX.GetNum(LayerNodes(1))
For i = 1 To LayerNodes(LayerNum) - 1
Load Combo(i)
Combo(i).Top = Combo(i - 1).Top + Combo(i - 1).Height + 20
Combo(i).Visible = True
Next i
Frame2.Height = Combo(LayerNodes(LayerNum) - 1).Top + Combo(LayerNodes(LayerNum) - 1).Height + 20
For i = 0 To LayerNodes(LayerNum) - 1
For j = 0 To n - 1
Combo(i).AddItem TrainFX.FunctionX(LayerNodes(1), j)
Next j
Next i
Frame2.Caption = "请分别选择" & LTrim(Str(LayerNodes(LayerNum))) & "个输出的训练函数"
Frame1.Top = Frame2.Top + Frame2.Height + 50
For i = 1 To LayerNodes(1) - 1
Load TxtInput(i)
Load Label1(i)
TxtInput(i).Top = TxtInput(i - 1).Top + TxtInput(i - 1).Height + 150
TxtInput(i).Left = TxtInput(i - 1).Left
TxtInput(i).Visible = True
Label1(i).Top = TxtInput(i).Top + 120
Label1(i).Left = Label1(i - 1).Left
Label1(i).Visible = True
Label1(i).Caption = "输入值" & Str(i + 1) & ":"
Next i
TxtOutput(0).Top = TxtInput(LayerNodes(1) - 1).Top + TxtInput(LayerNodes(1) - 1).Height + 150
TxtOutput(0).Left = TxtInput(LayerNodes(1) - 1).Left
Label2(0).Top = TxtOutput(0).Top + 120
Label2(0).Left = Label1(LayerNodes(1) - 1).Left
For i = 1 To LayerNodes(LayerNum) - 1
Load TxtOutput(i)
Load Label2(i)
TxtOutput(i).Top = TxtOutput(i - 1).Top + TxtOutput(i - 1).Height + 150
TxtOutput(i).Left = TxtOutput(i - 1).Left
TxtOutput(i).Visible = True
Label2(i).Top = TxtOutput(i).Top + 120
Label2(i).Left = Label1(0).Left
Label2(i).Caption = "输出值" & Str(i + 1) & ":"
Label2(i).Visible = True
Next i
Frame1.Height = TxtOutput(LayerNodes(LayerNum) - 1).Top _
+ TxtOutput(LayerNodes(LayerNum) - 1).Height + 200
Command1.Left = Frame1.Left + 100
Command1.Top = Frame1.Top + Frame1.Height + 300
Command2.Left = Frame1.Left + Frame1.Width - 100 - Command2.Width
Command2.Top = Command1.Top
Form8.Height = Command2.Top + Command2.Height + 550
End Sub
Private Sub TxtInput_KeyPress(Index As Integer, KeyAscii As Integer)
Dim i As Integer, n As Integer
Dim TrainFX
Set TrainFX = New FunctionDLL.TrainF
n = TrainFX.GetNum(LayerNodes(1))
If Index = LayerNodes(1) - 1 And KeyAscii = 13 Then
For i = 0 To LayerNodes(LayerNum) - 1
If Combo(i).Text <> "" Then
Select Case LayerNodes(1)
Case 1
TxtOutput(i) = TrainFX.dbOne(Combo(i).ListIndex, Val(TxtInput(0)))
Case 2
TxtOutput(i) = TrainFX.dbTwo(Combo(i).ListIndex, Val(TxtInput(0)), Val(TxtInput(1)))
Case 3
TxtOutput(i) = TrainFX.dbThree(Combo(i).ListIndex, Val(TxtInput(0)), Val(TxtInput(1)), Val(TxtInput(2)))
Case 4
TxtOutput(i) = TrainFX.dbFour(Combo(i).ListIndex, Val(TxtInput(0)), Val(TxtInput(1)), Val(TxtInput(2)), Val(TxtInput(3)))
End Select
End If
Next i
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -