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

📄 cblock.cls

📁 vb实现最短路径Dijkstra算法
💻 CLS
字号:
VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "cBlock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Attribute VB_Ext_KEY = "Member0" ,"blockCollection"
'  ==========================================
'  Dijkstra's algorithm to find Shortest Path
'  ==========================================
'
' E.W. Dijkstra is a Dutch professor in Computer
' Science, who did a lot of research in graphs.
'
' Dijkstra's algorithm is of use when working with
' directional graphs. It constructs the shortest path
' between a starting-node and a goal-node.
' It is assumed that every link between two nodes
' has a certain cost, and this algorithm finds the
' path between the two given nodes with the lowest cost.
'
' The idea of this VB project was to show the
' work of this algorithm in a visual way.
'
'    Screen-shot: dijkstra.gif
'
'
'    Visit my Homepage:
'    http://www.geocities.com/emu8086/vb/
'
'
'    Last Update: Saturday, July 20, 2002
'
'
'    Copyright 2002 Alexander Popov Emulation Soft.
'               All rights reserved.
'        http://www.geocities.com/emu8086/


Option Explicit

'local variable(s) to hold property value(s)
Public theObjectShape As Shape

'To fire this event, use RaiseEvent with the following syntax:
'RaiseEvent linkError[(arg1, arg2, ... , argn)]
Public Event linkError(sERROR As String)
'local variable(s) to hold property value(s)
Private mvarbSetUpperCaptionDown As Boolean 'local copy

Public Property Let bSetUpperCaptionDown(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.bSetUpperCaptionDown = 5
    mvarbSetUpperCaptionDown = vData
End Property


Public Property Get bSetUpperCaptionDown() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.bSetUpperCaptionDown
    bSetUpperCaptionDown = mvarbSetUpperCaptionDown
End Property





Public Property Let sCaptionUpper(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.sCaptionUpper = 5
    Form1.lblShapeCapUpper(theObjectShape.index).Caption = vData
End Property


Public Property Get sCaptionUpper() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.sCaptionUpper
    sCaptionUpper = Form1.lblShapeCapUpper(theObjectShape.index).Caption
End Property




Public Property Let sCaption(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.sCaption = 5
    Form1.lblShapeCap(theObjectShape.index).Caption = vData
End Property


Public Property Get sCaption() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.sCaption
    sCaption = Form1.lblShapeCap(theObjectShape.index).Caption
End Property





Public Property Let TagID(ByVal vData As String)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.TagID = 5
    theObjectShape.Tag = vData
End Property


Public Property Get TagID() As String
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.TagID
    TagID = theObjectShape.Tag
End Property





Public Property Let shapeBorderColor(ByVal vData As Long)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.shapeBorderColor = 5
    theObjectShape.BorderColor = vData
End Property


Public Property Get shapeBorderColor() As Long
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.shapeBorderColor
    shapeBorderColor = theObjectShape.BorderColor
End Property



Public Property Let shapeBackColor(ByVal vData As Long)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.shapeBackColor = 5
    theObjectShape.BackColor = vData
End Property


Public Property Get shapeBackColor() As Long
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.shapeBackColor
    shapeBackColor = theObjectShape.BackColor
End Property



Public Property Let shapeHeight(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.shapeHeight = 5
    theObjectShape.Height = vData
End Property


Public Property Get shapeHeight() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.shapeHeight
    shapeHeight = theObjectShape.Height
End Property



Public Property Let shapeWidth(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.shapeWidth = 5
    theObjectShape.Width = vData
End Property


Public Property Get shapeWidth() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.shapeWidth
    shapeWidth = theObjectShape.Width
End Property




Public Property Let Shape(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Shape = 5
    theObjectShape.Shape = vData
End Property


Public Property Get Shape() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Shape
    Shape = theObjectShape.Shape
End Property




Public Property Let Visible(ByVal vData As Boolean)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.Visible = 5
    theObjectShape.Visible = vData
End Property


Public Property Get Visible() As Boolean
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.Visible
    Visible = theObjectShape.Visible
End Property

Public Property Let shapeLeft(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.shapeLeft = 5
    theObjectShape.Left = vData
End Property


Public Property Get shapeLeft() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.shapeLeft
    shapeLeft = theObjectShape.Left
End Property



Public Property Let shapeTop(ByVal vData As Integer)
'used when assigning a value to the property, on the left side of an assignment.
'Syntax: X.shapeTop = 5
    theObjectShape.Top = vData
End Property


Public Property Get shapeTop() As Integer
'used when retrieving value of a property, on the right side of an assignment.
'Syntax: Debug.Print X.shapeTop
    shapeTop = theObjectShape.Top
End Property

Public Sub updateShapeCaptionPos()

        Dim i As Integer
        
        i = theObjectShape.index
        
        Form1.lblShapeCap(i).Left = theObjectShape.Left + theObjectShape.Width / 2 - Form1.lblShapeCap(i).Width / 2
        Form1.lblShapeCap(i).Top = theObjectShape.Top + theObjectShape.Height / 2 - Form1.lblShapeCap(i).Height / 2
      
        If mvarbSetUpperCaptionDown Then
            Form1.lblShapeCapUpper(i).Left = theObjectShape.Left + theObjectShape.Width / 2 - Form1.lblShapeCapUpper(i).Width / 2
            Form1.lblShapeCapUpper(i).Top = theObjectShape.Top + theObjectShape.Height + 4
        Else
            Form1.lblShapeCapUpper(i).Left = theObjectShape.Left + theObjectShape.Width / 2 - Form1.lblShapeCapUpper(i).Width / 2
            Form1.lblShapeCapUpper(i).Top = theObjectShape.Top - Form1.lblShapeCapUpper(i).Height - 4
        End If
End Sub

⌨️ 快捷键说明

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