⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 最短路径计算.frm

📁 饮羽公路测设(glcs) 由20多个公路测量、设计、试验和施工组织设计等小软件组成。如《中桩大地坐标》可以计算不等长缓和曲线的中桩和边桩的大地坐标;《缓和曲线反算》可以根据切线长、外距长或缓和曲线长求
💻 FRM
字号:
VERSION 5.00
Object = "{D76D7130-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSFLEX7D.OCX"
Begin VB.Form frmzdljjs 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "最短路径计算"
   ClientHeight    =   4485
   ClientLeft      =   45
   ClientTop       =   345
   ClientWidth     =   6885
   Icon            =   "最短路径计算.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4485
   ScaleWidth      =   6885
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text5 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H8000000F&
      Height          =   270
      Left            =   0
      TabIndex        =   12
      Text            =   "Text5"
      Top             =   4120
      Width           =   4935
   End
   Begin VSFlex7DAOCtl.VSFlexGrid VSFlexGrid1 
      Height          =   3375
      Left            =   0
      TabIndex        =   11
      Top             =   600
      Width           =   6855
      _cx             =   12091
      _cy             =   5953
      _ConvInfo       =   1
      Appearance      =   1
      BorderStyle     =   1
      Enabled         =   -1  'True
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      MousePointer    =   0
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      BackColorFixed  =   -2147483633
      ForeColorFixed  =   -2147483630
      BackColorSel    =   -2147483635
      ForeColorSel    =   -2147483634
      BackColorBkg    =   14737632
      BackColorAlternate=   -2147483643
      GridColor       =   -2147483633
      GridColorFixed  =   -2147483632
      TreeColor       =   -2147483632
      FloodColor      =   192
      SheetBorder     =   -2147483642
      FocusRect       =   3
      HighLight       =   1
      AllowSelection  =   -1  'True
      AllowBigSelection=   -1  'True
      AllowUserResizing=   3
      SelectionMode   =   0
      GridLines       =   1
      GridLinesFixed  =   2
      GridLineWidth   =   1
      Rows            =   2
      Cols            =   4
      FixedRows       =   1
      FixedCols       =   1
      RowHeightMin    =   0
      RowHeightMax    =   0
      ColWidthMin     =   0
      ColWidthMax     =   0
      ExtendLastCol   =   0   'False
      FormatString    =   ""
      ScrollTrack     =   0   'False
      ScrollBars      =   3
      ScrollTips      =   0   'False
      MergeCells      =   0
      MergeCompare    =   0
      AutoResize      =   -1  'True
      AutoSizeMode    =   0
      AutoSearch      =   0
      AutoSearchDelay =   2
      MultiTotals     =   -1  'True
      SubtotalPosition=   1
      OutlineBar      =   0
      OutlineCol      =   0
      Ellipsis        =   0
      ExplorerBar     =   0
      PicturesOver    =   0   'False
      FillStyle       =   0
      RightToLeft     =   0   'False
      PictureType     =   0
      TabBehavior     =   0
      OwnerDraw       =   0
      Editable        =   2
      ShowComboButton =   -1  'True
      WordWrap        =   0   'False
      TextStyle       =   0
      TextStyleFixed  =   0
      OleDragMode     =   0
      OleDropMode     =   0
      DataMode        =   0
      VirtualData     =   -1  'True
      ComboSearch     =   3
      AutoSizeMouse   =   -1  'True
      FrozenRows      =   0
      FrozenCols      =   0
      AllowUserFreezing=   3
      BackColorFrozen =   0
      ForeColorFrozen =   0
      WallPaperAlignment=   9
   End
   Begin VB.Frame Frame1 
      Caption         =   "原始数据"
      Height          =   615
      Left            =   0
      TabIndex        =   6
      Top             =   0
      Width           =   6855
      Begin VB.TextBox Text4 
         Height          =   270
         Left            =   5880
         TabIndex        =   3
         Text            =   "Text4"
         Top             =   240
         Width           =   855
      End
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   4200
         TabIndex        =   2
         Text            =   "Text3"
         Top             =   240
         Width           =   855
      End
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   2520
         TabIndex        =   1
         Text            =   "Text2"
         Top             =   240
         Width           =   855
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   840
         TabIndex        =   0
         Text            =   "Text1"
         Top             =   240
         Width           =   855
      End
      Begin VB.Label Label4 
         Caption         =   "终结点号"
         Height          =   255
         Left            =   5160
         TabIndex        =   10
         Top             =   285
         Width           =   735
      End
      Begin VB.Label Label3 
         Caption         =   "始结点号"
         Height          =   255
         Left            =   3480
         TabIndex        =   9
         Top             =   285
         Width           =   735
      End
      Begin VB.Label Label2 
         Caption         =   "路段数目"
         Height          =   255
         Left            =   1800
         TabIndex        =   8
         Top             =   285
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "结点数目"
         Height          =   255
         Left            =   120
         TabIndex        =   7
         Top             =   280
         Width           =   855
      End
   End
   Begin VB.CommandButton Command2 
      Caption         =   "关闭"
      Height          =   375
      Left            =   6000
      TabIndex        =   5
      Top             =   4080
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   375
      Left            =   5040
      TabIndex        =   4
      Top             =   4080
      Width           =   855
   End
End
Attribute VB_Name = "frmzdljjs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a(), b(), g(), w(), x(), y(), z()



Private Sub Command1_Click()
'计算

    On Error GoTo handlerror

    n = Val(Text1.Text)
    c = Val(Text2.Text)
    S = Val(Text3.Text)
    h = Val(Text4.Text)
    
    ReDim a(n + 1, 4), b(c + 1, 3), g(c * 3)
    ReDim w(n + 1), x(c), y(c), z(c)
    
bl10:   For i = 1 To n
            a(i, 1) = 1
            a(i, 2) = 1000000
            a(i, 3) = 0
            a(i, 4) = 0
        Next i
        a(S, 2) = 0
        
        For p = 1 To c
            aa = Val(VSFlexGrid1.TextMatrix(p, 1))
            bb = Val(VSFlexGrid1.TextMatrix(p, 2))
            rr = Val(VSFlexGrid1.TextMatrix(p, 3))
            g(p * 1) = aa
            g(p * 2) = bb
            g(p * 3) = rr
            b(p, 2) = bb
            x(p) = bb
            y(p) = rr
            b(p, 3) = rr
            b(p, 1) = a(aa, 4)
            z(p) = a(aa, 4)
            a(aa, 4) = p
        Next p
        For i = 1 To n + 1
            w(i) = a(i, 4)
        Next i
'        Call jeigo(c, g())
bl20:   i = S
        GoTo bl50
bl30:   i = i + 1
        If i < n Or i = n Then GoTo bl40
        i = 1
        k = k + 1
        If k > 1 Then GoTo bl80
        
bl40:   If a(i, 1) = 0 Then GoTo bl30
bl50:   j = a(i, 4)
        k = 0
bl60:   t = a(i, 2) + b(j, 3)
        l = b(j, 2)
        If a(l, 2) < t Then GoTo bl70
        a(l, 1) = 1
        a(l, 2) = t
        a(l, 3) = i
bl70:   j = b(j, 1)
        If j < 0 Or j > 0 Then GoTo bl60
        a(i, 1) = 0
        GoTo bl30
bl80:   Text5.Text = "从起点" + Trim$(Str(S)) + "到终点" + Trim$(Str(h))
        Text5.Text = Text5.Text + "的最短路径长度是" + Trim$(Str(a(h, 2)))
        Text5.Text = Text5.Text + "最短路径为:" + Trim$(Str(h))
        xx = a(h, 3)
        Do While xx <> 0
            Text5.Text = Text5.Text + "←" + Trim$(Str(xx))
            xx = a(xx, 3)
        Loop
        
    
    Exit Sub
handlerror:
    xianshi = MsgBox("请检查输入的数据后再计算!", vbInformation, "问题提示")

End Sub

Private Sub Command2_Click()
'关闭
    
    On Error GoTo handlerror
    
        '写入文本框
    If rjsfzc = 88 And VSFlexGrid1.Rows > 2 Then
        
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    《最短路径计算》:"
        frmMain.Text1 = frmMain.Text1 & vbCrLf & ""
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + "节点数目=" + Text1.Text
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + "路段数目=" + Text2.Text
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + "始节点号=" + Text3.Text
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + "终节点号=" + Text4.Text
        
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    " + VSFlexGrid1.TextMatrix(0, 0) + "    " + VSFlexGrid1.TextMatrix(0, 1) + "    " + VSFlexGrid1.TextMatrix(0, 2) + "    " + VSFlexGrid1.TextMatrix(0, 3)
        
        For i = 1 To VSFlexGrid1.Rows - 1
            wbbb = "    "
            For j = 0 To VSFlexGrid1.Cols - 1
                wbbb = wbbb + VSFlexGrid1.TextMatrix(i, j)
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 0 Then kgg = "             "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 1 Then kgg = "            "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 2 Then kgg = "           "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 3 Then kgg = "          "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 4 Then kgg = "         "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 5 Then kgg = "        "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 6 Then kgg = "       "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 7 Then kgg = "      "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 8 Then kgg = "     "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 9 Then kgg = "    "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 10 Then kgg = "   "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 11 Then kgg = "  "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 12 Then kgg = " "
                If Len(VSFlexGrid1.TextMatrix(i, j)) = 13 Then kgg = ""
                wbbb = wbbb + kgg
            Next j
            frmMain.Text1 = frmMain.Text1 & vbCrLf & wbbb
        Next i
        
        frmMain.Text1 = frmMain.Text1 & vbCrLf & "    --------------------------------------"
    End If
    
    Unload Me

    Exit Sub
handlerror:

End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
'Esc键退出,VbEscape可以用27代替
    On Error GoTo handlerror

    If KeyAscii = 27 Then
        Unload Me
    End If
    
    Exit Sub
handlerror:

End Sub

Private Sub Form_Load()
'启动

    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    
    With VSFlexGrid1
        .ColAlignment(0) = flexAlignCenterCenter
        .ColAlignment(1) = flexAlignCenterCenter
        .ColAlignment(2) = flexAlignCenterCenter
        .ColAlignment(3) = flexAlignCenterCenter
        .ColWidth(0) = 1400
        .ColWidth(1) = 1680
        .ColWidth(2) = 1680
        .ColWidth(3) = 1680
        .TextMatrix(0, 0) = "路段序号"
        .TextMatrix(0, 1) = "起 点 号"
        .TextMatrix(0, 2) = "终 点 号"
        .TextMatrix(0, 3) = "路 段 长"
    End With

End Sub

Private Sub Text2_Change()
'路段数目

    If Val(Text2.Text) > 1 Then
        VSFlexGrid1.Rows = Val(Text2.Text) + 1
        For i = 1 To VSFlexGrid1.Rows - 1
            VSFlexGrid1.TextMatrix(i, 0) = i
        Next i
    End If

End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -