📄 frmhop.frm
字号:
For i = 1 To PP
For j = 1 To NN
temp(j) = A(i, j)
Next j
D_Start.Caption = D_Start.Caption & HanMin(temp, b) & ","
Next i
Call RememberMode
E_End.Caption = "E=" & Energy(b)
D_End.Caption = "D="
For i = 1 To PP
For j = 1 To NN
temp(j) = A(i, j)
Next j
D_End.Caption = D_End.Caption & HanMin(temp, b) & ","
Next i
Call Write_Result
Call Write_Change
End Sub
Private Sub Command2_Click()
Call Read_RememberMode
E_Start.Caption = "Energy"
Call RememberMode
E_End.Caption = "Energy"
Call Write_Result
Call Write_Change
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
ReDim A(PP, NN)
ReDim W(NN, NN)
ReDim Q(NN)
ReDim b(NN)
ReDim y(NN)
ReDim Change(NN)
Call Pic1Redraw
Call Text1Load
Call Pic3Redraw
Call Text2Load
Call Pic5Redraw
Call Text3Load
Call Pic7Redraw
Call Text4Load
End Sub
Private Sub Read_StudyMode()
Dim i, j As Integer
Dim aa() As Integer
ReDim aa(NN * PP)
For i = 0 To PP * XX - 1 '水平表格中的各个文本框
For j = 1 To YY '垂直表格中的各个文本框
aa(i * YY + j) = Val(Text1(i * YY + j).Text)
If Text1(i * YY + j).Text = 1 Then
Text1(i * YY + j).ForeColor = RGB(255, 0, 0)
ElseIf Text1(i * YY + j).Text = -1 Then
Text1(i * YY + j).ForeColor = RGB(0, 0, 255)
End If
Next j
Next i
For i = 0 To PP - 1
For j = 1 To NN
A(i + 1, j) = aa(i * NN + j)
Next j
Next i
End Sub
Private Sub Read_RememberMode()
Dim i, j As Integer
For i = 0 To XX - 1 '水平表格中的各个文本框
For j = 1 To YY '垂直表格中的各个文本框
b(i * YY + j) = Val(Text3(i * YY + j).Text)
If Text3(i * YY + j).Text = 1 Then
Text3(i * YY + j).ForeColor = RGB(255, 0, 0)
ElseIf Text3(i * YY + j).Text = -1 Then
Text3(i * YY + j).ForeColor = RGB(0, 0, 255)
End If
Next j
Next i
End Sub
Private Sub Write_Change()
Dim i, j As Integer
For i = 0 To XX - 1 '水平表格中的各个文本框
For j = 1 To YY '垂直表格中的各个文本框
Text2(i * YY + j).Text = Change(i * YY + j)
Next j
Next i
End Sub
Private Sub Write_Result()
Dim i, j As Integer
For i = 0 To XX - 1 '水平表格中的各个文本框
For j = 1 To YY '垂直表格中的各个文本框
Text4(i * YY + j).Text = y(i * YY + j)
If Text4(i * YY + j).Text = 1 Then
Text4(i * YY + j).ForeColor = RGB(255, 0, 0)
ElseIf Text4(i * YY + j).Text = -1 Then
Text4(i * YY + j).ForeColor = RGB(0, 0, 255)
End If
Next j
Next i
End Sub
Private Sub Pic1Redraw() '视窗图片重绘子程序
'设置表格载体图片控件的属性
Picture2.Width = YY * Text1(0).Width + 50
Picture2.Height = PP * XX * Text1(0).Height + 50
'判断滚动条出现的不同情况
If Picture1.Width < Picture2.Width + Picture2.Left * 2 _
And Picture1.Height < Picture2.Height + Picture2.Top * 2 Then
'水平、垂直滚动条都出现
HScroll1.Left = 0
HScroll1.Top = Picture1.Height - HScroll1.Height
HScroll1.Width = Picture1.Width
HScroll1.Max = Picture2.Width + 2 * Picture2.Left - Picture1.Width
HScroll1.Min = 0
VScroll1.Top = 0
VScroll1.Left = Picture1.Width - VScroll1.Width
VScroll1.Height = Picture1.Height - HScroll1.Height
VScroll1.Max = Picture2.Height + 2 * Picture2.Top - Picture1.Height
VScroll1.Min = 0
HScroll1.Visible = True
VScroll1.Visible = True
ElseIf Picture1.Width < Picture2.Width + Picture2.Left * 2 Then
'只出现水平滚动条
HScroll1.Left = 0
HScroll1.Top = Picture1.Height - HScroll1.Height
HScroll1.Width = Picture1.Width
HScroll1.Max = Picture2.Width + 2 * Picture2.Left - Picture1.Width
HScroll1.Min = 0
HScroll1.Visible = True
VScroll1.Visible = False
ElseIf Picture1.Height < Picture2.Height + Picture2.Top * 2 Then
'只出现垂直滚动条
VScroll1.Top = 0
VScroll1.Left = Picture1.Width - VScroll1.Width
VScroll1.Height = Picture1.Height
VScroll1.Max = Picture2.Height + 2 * Picture2.Top - Picture1.Height
VScroll1.Min = 0
HScroll1.Visible = False
VScroll1.Visible = True
Else
HScroll1.Visible = False
VScroll1.Visible = False
End If
HScroll1.SmallChange = 20
HScroll1.LargeChange = (HScroll1.Max - HScroll1.Min) / 10
HScroll1.Value = 0
VScroll1.SmallChange = 20
VScroll1.LargeChange = (VScroll1.Max - VScroll1.Min) / 10
VScroll1.Value = 0
End Sub
Private Sub HScroll1_Change() '水平滚动条变化
Picture2.Left = 0 - HScroll1.Value
End Sub
Private Sub Text1Load() '调入文本框控件
Dim i, j As Integer
For i = 0 To PP * XX - 1 '调入水平表格中的各个文本框
For j = 1 To YY '调入垂直表格中的各个文本框
Load Text1(i * YY + j)
Text1(i * YY + j).Visible = True
Text1(i * YY + j).Left = Text1(0).Width * (j - 1)
Text1(i * YY + j).Top = Text1(0).Height * i
Text1(i * YY + j).Text = ""
Next j
Next i
End Sub
Private Sub Text1_Change(Index As Integer)
Command1.Enabled = True
End Sub
Private Sub VScroll1_Change() '垂直滚动条
Picture2.Top = 0 - VScroll1.Value
End Sub
Private Sub Pic3Redraw() '视窗图片重绘子程序
'设置表格载体图片控件的属性
Picture4.Width = YY * Text2(0).Width + 50
Picture4.Height = XX * Text2(0).Height + 50
'判断滚动条出现的不同情况
If Picture3.Width < Picture4.Width + Picture4.Left * 2 _
And Picture3.Height < Picture4.Height + Picture4.Top * 2 Then
'水平、垂直滚动条都出现
HScroll2.Left = 0
HScroll2.Top = Picture3.Height - HScroll2.Height
HScroll2.Width = Picture3.Width
HScroll2.Max = Picture4.Width + 2 * Picture4.Left - Picture3.Width
HScroll2.Min = 0
VScroll2.Top = 0
VScroll2.Left = Picture3.Width - VScroll2.Width
VScroll2.Height = Picture3.Height - HScroll3.Height
VScroll2.Max = Picture4.Height + 2 * Picture4.Top - Picture3.Height
VScroll2.Min = 0
HScroll2.Visible = True
VScroll2.Visible = True
ElseIf Picture3.Width < Picture4.Width + Picture4.Left * 2 Then
'只出现水平滚动条
HScroll2.Left = 0
HScroll2.Top = Picture3.Height - HScroll2.Height
HScroll2.Width = Picture3.Width
HScroll2.Max = Picture4.Width + 2 * Picture4.Left - Picture1.Width
HScroll2.Min = 0
HScroll2.Visible = True
VScroll2.Visible = False
ElseIf Picture3.Height < Picture4.Height + Picture4.Top * 2 Then
'只出现垂直滚动条
VScroll2.Top = 0
VScroll2.Left = Picture3.Width - VScroll2.Width
VScroll2.Height = Picture3.Height
VScroll2.Max = Picture4.Height + 2 * Picture4.Top - Picture3.Height
VScroll2.Min = 0
HScroll2.Visible = False
VScroll2.Visible = True
Else
HScroll2.Visible = False
VScroll2.Visible = False
End If
HScroll2.SmallChange = 20
HScroll2.LargeChange = (HScroll2.Max - HScroll2.Min) / 10
HScroll2.Value = 0
VScroll2.SmallChange = 20
VScroll2.LargeChange = (VScroll2.Max - VScroll2.Min) / 10
VScroll2.Value = 0
End Sub
Private Sub HScroll2_Change() '水平滚动条变化
Picture4.Left = 0 - HScroll2.Value
End Sub
Private Sub Text2Load() '调入文本框控件
Dim i, j As Integer
For i = 0 To XX - 1 '调入水平表格中的各个文本框
For j = 1 To YY '调入垂直表格中的各个文本框
Load Text2(i * YY + j)
Text2(i * YY + j).Visible = True
Text2(i * YY + j).Left = Text2(0).Width * (j - 1)
Text2(i * YY + j).Top = Text2(0).Height * i
Text2(i * YY + j).Text = ""
Next j
Next i
End Sub
Private Sub VScroll2_Change() '垂直滚动条
Picture4.Top = 0 - VScroll2.Value
End Sub
Private Sub Pic5Redraw() '视窗图片重绘子程序
'设置表格载体图片控件的属性
Picture6.Width = YY * Text3(0).Width + 50
Picture6.Height = XX * Text3(0).Height + 50
'判断滚动条出现的不同情况
If Picture5.Width < Picture6.Width + Picture6.Left * 2 _
And Picture5.Height < Picture6.Height + Picture6.Top * 2 Then
'水平、垂直滚动条都出现
HScroll3.Left = 0
HScroll3.Top = Picture5.Height - HScroll3.Height
HScroll3.Width = Picture5.Width
HScroll3.Max = Picture6.Width + 2 * Picture6.Left - Picture5.Width
HScroll3.Min = 0
VScroll3.Top = 0
VScroll3.Left = Picture5.Width - VScroll3.Width
VScroll3.Height = Picture5.Height - HScroll3.Height
VScroll3.Max = Picture6.Height + 2 * Picture6.Top - Picture5.Height
VScroll3.Min = 0
HScroll3.Visible = True
VScroll3.Visible = True
ElseIf Picture5.Width < Picture6.Width + Picture6.Left * 2 Then
'只出现水平滚动条
HScroll3.Left = 0
HScroll3.Top = Picture5.Height - HScroll3.Height
HScroll3.Width = Picture5.Width
HScroll3.Max = Picture6.Width + 2 * Picture6.Left - Picture5.Width
HScroll3.Min = 0
HScroll3.Visible = True
VScroll3.Visible = False
ElseIf Picture5.Height < Picture6.Height + Picture6.Top * 2 Then
'只出现垂直滚动条
VScroll3.Top = 0
VScroll3.Left = Picture5.Width - VScroll3.Width
VScroll3.Height = Picture5.Height
VScroll3.Max = Picture6.Height + 2 * Picture6.Top - Picture5.Height
VScroll3.Min = 0
HScroll3.Visible = False
VScroll3.Visible = True
Else
HScroll3.Visible = False
VScroll3.Visible = False
End If
HScroll3.SmallChange = 20
HScroll3.LargeChange = (HScroll3.Max - HScroll3.Min) / 10
HScroll3.Value = 0
VScroll3.SmallChange = 20
VScroll3.LargeChange = (VScroll3.Max - VScroll3.Min) / 10
VScroll3.Value = 0
End Sub
Private Sub Hscroll3_Change() '水平滚动条变化
Picture6.Left = 0 - HScroll3.Value
End Sub
Private Sub Text3Load() '调入文本框控件
Dim i, j As Integer
For i = 0 To XX - 1 '调入水平表格中的各个文本框
For j = 1 To YY '调入垂直表格中的各个文本框
Load Text3(i * YY + j)
Text3(i * YY + j).Visible = True
Text3(i * YY + j).Left = Text3(0).Width * (j - 1)
Text3(i * YY + j).Top = Text3(0).Height * i
Text3(i * YY + j).Text = ""
Next j
Next i
End Sub
Private Sub vscroll3_Change() '垂直滚动条
Picture6.Top = 0 - VScroll3.Value
End Sub
Private Sub Pic7Redraw() '视窗图片重绘子程序
'设置表格载体图片控件的属性
Picture8.Visible = True
Picture8.Width = YY * Text4(0).Width + 50
Picture8.Height = XX * Text4(0).Height + 50
'判断滚动条出现的不同情况
If Picture7.Width < Picture8.Width + Picture8.Left * 2 _
And Picture7.Height < Picture8.Height + Picture8.Top * 2 Then
'水平、垂直滚动条都出现
HScroll4.Left = 0
HScroll4.Top = Picture7.Height - HScroll4.Height
HScroll4.Width = Picture7.Width
HScroll4.Max = Picture8.Width + 2 * Picture8.Left - Picture7.Width
HScroll4.Min = 0
VScroll4.Top = 0
VScroll4.Left = Picture7.Width - VScroll4.Width
VScroll4.Height = Picture7.Height - HScroll4.Height
VScroll4.Max = Picture8.Height + 2 * Picture8.Top - Picture7.Height
VScroll4.Min = 0
HScroll4.Visible = True
VScroll4.Visible = True
ElseIf Picture7.Width < Picture8.Width + Picture8.Left * 2 Then
'只出现水平滚动条
HScroll4.Left = 0
HScroll4.Top = Picture7.Height - HScroll4.Height
HScroll4.Width = Picture7.Width
HScroll4.Max = Picture8.Width + 2 * Picture8.Left - Picture7.Width
HScroll4.Min = 0
HScroll4.Visible = True
VScroll4.Visible = False
ElseIf Picture7.Height < Picture8.Height + Picture8.Top * 2 Then
'只出现垂直滚动条
VScroll4.Top = 0
VScroll4.Left = Picture7.Width - VScroll4.Width
VScroll4.Height = Picture7.Height
VScroll4.Max = Picture8.Height + 2 * Picture8.Top - Picture7.Height
VScroll4.Min = 0
HScroll4.Visible = False
VScroll4.Visible = True
Else
HScroll4.Visible = False
VScroll4.Visible = False
End If
HScroll4.SmallChange = 20
HScroll4.LargeChange = (HScroll4.Max - HScroll4.Min) / 10
HScroll4.Value = 0
VScroll4.SmallChange = 20
VScroll4.LargeChange = (VScroll4.Max - VScroll4.Min) / 10
VScroll4.Value = 0
End Sub
Private Sub hscroll4_Change() '水平滚动条变化
Picture8.Left = 0 - HScroll4.Value
End Sub
Private Sub Text4Load() '调入文本框控件
Dim i, j As Integer
For i = 0 To XX - 1 '调入水平表格中的各个文本框
For j = 1 To YY '调入垂直表格中的各个文本框
Load Text4(i * YY + j)
Text4(i * YY + j).Visible = True
Text4(i * YY + j).Left = Text4(0).Width * (j - 1)
Text4(i * YY + j).Top = Text4(0).Height * i
Text4(i * YY + j).Text = ""
Next j
Next i
End Sub
Private Sub vscroll4_Change() '垂直滚动条
Picture8.Top = 0 - VScroll4.Value
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -