📄 frmmain.vb
字号:
Me.lblBest.Name = "lblBest"
Me.lblBest.Size = New System.Drawing.Size(80, 23)
Me.lblBest.TabIndex = 9
'
'lblGo
'
Me.lblGo.ForeColor = System.Drawing.Color.Magenta
Me.lblGo.Location = New System.Drawing.Point(264, 24)
Me.lblGo.Name = "lblGo"
Me.lblGo.Size = New System.Drawing.Size(64, 23)
Me.lblGo.TabIndex = 8
'
'GroupBox3
'
Me.GroupBox3.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.GroupBox3.Controls.Add(Me.txt99)
Me.GroupBox3.Controls.Add(Me.txt88)
Me.GroupBox3.Controls.Add(Me.txt77)
Me.GroupBox3.Controls.Add(Me.txt66)
Me.GroupBox3.Controls.Add(Me.txt55)
Me.GroupBox3.Controls.Add(Me.txt44)
Me.GroupBox3.Controls.Add(Me.txt33)
Me.GroupBox3.Controls.Add(Me.txt22)
Me.GroupBox3.Controls.Add(Me.txt11)
Me.GroupBox3.ForeColor = System.Drawing.Color.FromArgb(CType(255, Byte), CType(192, Byte), CType(255, Byte))
Me.GroupBox3.Location = New System.Drawing.Point(16, 168)
Me.GroupBox3.Name = "GroupBox3"
Me.GroupBox3.Size = New System.Drawing.Size(128, 128)
Me.GroupBox3.TabIndex = 7
Me.GroupBox3.TabStop = False
Me.GroupBox3.Text = "过程值:"
'
'txt99
'
Me.txt99.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt99.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt99.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt99.ForeColor = System.Drawing.Color.Lime
Me.txt99.Location = New System.Drawing.Point(88, 88)
Me.txt99.Name = "txt99"
Me.txt99.ReadOnly = True
Me.txt99.Size = New System.Drawing.Size(21, 21)
Me.txt99.TabIndex = 9
Me.txt99.Text = "0"
Me.txt99.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt88
'
Me.txt88.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt88.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt88.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt88.ForeColor = System.Drawing.Color.Lime
Me.txt88.Location = New System.Drawing.Point(56, 88)
Me.txt88.Name = "txt88"
Me.txt88.ReadOnly = True
Me.txt88.Size = New System.Drawing.Size(21, 21)
Me.txt88.TabIndex = 8
Me.txt88.Text = "0"
Me.txt88.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt77
'
Me.txt77.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt77.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt77.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt77.ForeColor = System.Drawing.Color.Lime
Me.txt77.Location = New System.Drawing.Point(24, 88)
Me.txt77.Name = "txt77"
Me.txt77.ReadOnly = True
Me.txt77.Size = New System.Drawing.Size(21, 21)
Me.txt77.TabIndex = 7
Me.txt77.Text = "0"
Me.txt77.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt66
'
Me.txt66.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt66.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt66.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt66.ForeColor = System.Drawing.Color.Lime
Me.txt66.Location = New System.Drawing.Point(88, 56)
Me.txt66.Name = "txt66"
Me.txt66.ReadOnly = True
Me.txt66.Size = New System.Drawing.Size(21, 21)
Me.txt66.TabIndex = 6
Me.txt66.Text = "0"
Me.txt66.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt55
'
Me.txt55.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt55.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt55.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt55.ForeColor = System.Drawing.Color.Lime
Me.txt55.Location = New System.Drawing.Point(56, 56)
Me.txt55.Name = "txt55"
Me.txt55.ReadOnly = True
Me.txt55.Size = New System.Drawing.Size(21, 21)
Me.txt55.TabIndex = 5
Me.txt55.Text = "0"
Me.txt55.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt44
'
Me.txt44.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt44.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt44.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt44.ForeColor = System.Drawing.Color.Lime
Me.txt44.Location = New System.Drawing.Point(24, 56)
Me.txt44.Name = "txt44"
Me.txt44.ReadOnly = True
Me.txt44.Size = New System.Drawing.Size(21, 21)
Me.txt44.TabIndex = 4
Me.txt44.Text = "0"
Me.txt44.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt33
'
Me.txt33.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt33.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt33.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt33.ForeColor = System.Drawing.Color.Lime
Me.txt33.Location = New System.Drawing.Point(88, 24)
Me.txt33.Name = "txt33"
Me.txt33.ReadOnly = True
Me.txt33.Size = New System.Drawing.Size(21, 21)
Me.txt33.TabIndex = 3
Me.txt33.Text = "0"
Me.txt33.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt22
'
Me.txt22.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt22.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt22.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt22.ForeColor = System.Drawing.Color.Lime
Me.txt22.Location = New System.Drawing.Point(56, 24)
Me.txt22.Name = "txt22"
Me.txt22.ReadOnly = True
Me.txt22.Size = New System.Drawing.Size(21, 21)
Me.txt22.TabIndex = 2
Me.txt22.Text = "0"
Me.txt22.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txt11
'
Me.txt11.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.txt11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.txt11.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.txt11.ForeColor = System.Drawing.Color.Lime
Me.txt11.Location = New System.Drawing.Point(24, 24)
Me.txt11.Name = "txt11"
Me.txt11.ReadOnly = True
Me.txt11.Size = New System.Drawing.Size(21, 21)
Me.txt11.TabIndex = 1
Me.txt11.Text = "0"
Me.txt11.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(352, 24)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(72, 16)
Me.Label2.TabIndex = 2
Me.Label2.Text = "最优路径:"
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(168, 24)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(96, 16)
Me.Label3.TabIndex = 2
Me.Label3.Text = "实际搜索路径:"
'
'cmdOK
'
Me.cmdOK.Location = New System.Drawing.Point(376, 8)
Me.cmdOK.Name = "cmdOK"
Me.cmdOK.TabIndex = 6
Me.cmdOK.Text = "开 始"
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1, Me.MenuItem7})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuSaveBest, Me.mnuSaveGo, Me.MenuItem4, Me.mnuexit})
Me.MenuItem1.Text = "文件"
'
'mnuSaveBest
'
Me.mnuSaveBest.Index = 0
Me.mnuSaveBest.Text = "保存最优路径"
'
'mnuSaveGo
'
Me.mnuSaveGo.Index = 1
Me.mnuSaveGo.Text = "保存实际搜索路径"
'
'MenuItem4
'
Me.MenuItem4.Index = 2
Me.MenuItem4.Text = "-"
'
'mnuexit
'
Me.mnuexit.Index = 3
Me.mnuexit.Text = "退出"
'
'MenuItem7
'
Me.MenuItem7.Index = 1
Me.MenuItem7.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuHow, Me.MenuItem9, Me.mnuAbout})
Me.MenuItem7.Text = "帮助"
'
'mnuHow
'
Me.mnuHow.Index = 0
Me.mnuHow.Text = "使用说明"
'
'MenuItem9
'
Me.MenuItem9.Index = 1
Me.MenuItem9.Text = "-"
'
'mnuAbout
'
Me.mnuAbout.Index = 2
Me.mnuAbout.Text = "关于 重排九宫问题"
'
'txtSavePath
'
Me.txtSavePath.BackColor = System.Drawing.Color.FromArgb(CType(128, Byte), CType(128, Byte), CType(255, Byte))
Me.txtSavePath.BorderStyle = System.Windows.Forms.BorderStyle.None
Me.txtSavePath.Dock = System.Windows.Forms.DockStyle.Bottom
Me.txtSavePath.ForeColor = System.Drawing.Color.Aqua
Me.txtSavePath.Location = New System.Drawing.Point(0, 371)
Me.txtSavePath.Name = "txtSavePath"
Me.txtSavePath.ReadOnly = True
Me.txtSavePath.Size = New System.Drawing.Size(552, 14)
Me.txtSavePath.TabIndex = 7
Me.txtSavePath.Text = ""
'
'frmMain
'
Me.AutoScaleBaseSize = New System.Drawing.Size(7, 14)
Me.BackColor = System.Drawing.Color.FromArgb(CType(192, Byte), CType(192, Byte), CType(255, Byte))
Me.ClientSize = New System.Drawing.Size(552, 385)
Me.Controls.Add(Me.txtSavePath)
Me.Controls.Add(Me.cmdOK)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtIN)
Me.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.ForeColor = System.Drawing.Color.Blue
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Menu = Me.MainMenu1
Me.Name = "frmMain"
Me.Text = "重排九宫问题求解"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox3.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private n, m, t As Int16
Private arrayTxt(8), arrayTxtGo(8) As TextBox
Private strBD1, strC As String
Private intS, intP, intCount As Int32
Private str1 As String
Private colIn As New Collection
Private bln1, bln2 As Boolean
'搜索函数
Private Sub Go()
'结束搜索
'任务失败退出
If colOpen.Count = 0 Then
MsgBox("搜索失败")
Exit Sub
End If
'取open表中的值放入close表中
strBD = colOpen(1)
colOpen.Remove(1)
cData = strBD.Substring(BD.c, conL)
Steps = strBD.Substring(BD.s, conL)
intCount = colClose.Count
Do
For t = 1 To intCount '检查是否有重复接点
strBD1 = colClose(t)
strC = strBD1.Substring(BD.c, 9)
If strC.Equals(cData) Then
intS = strBD1.Substring(BD.s, conL)
If (Steps < intS) Then '检查重复接点的优先级,判断是否调整接点的参数
colClose.Add(strBD, , , t)
colClose.Remove(t)
End If
strBD = colOpen(1)
colOpen.Remove(1)
cData = strBD.Substring(BD.c, conL)
Steps = strBD.Substring(BD.s, conL)
Exit For
End If
Next
Loop While t <= intCount
colClose.Add(strBD, , 1)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -