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

📄 frmlinksetup.frm

📁 一个交通专用的gis-T系统
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Begin VB.Form FrmLinkSetup 
   Caption         =   "图元属性"
   ClientHeight    =   1845
   ClientLeft      =   2790
   ClientTop       =   3975
   ClientWidth     =   2670
   Icon            =   "FrmLinkSetup.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   1845
   ScaleWidth      =   2670
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Caption         =   "路段图元属性编辑"
      Height          =   1215
      Left            =   0
      TabIndex        =   4
      Top             =   120
      Width           =   2655
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         Height          =   270
         Left            =   1680
         TabIndex        =   0
         Text            =   "3"
         ToolTipText     =   "单位为实际坐标单位(米)"
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Appearance      =   0  'Flat
         BackColor       =   &H000000FF&
         BorderStyle     =   1  'Fixed Single
         ForeColor       =   &H80000008&
         Height          =   255
         Left            =   1680
         TabIndex        =   1
         Top             =   840
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "道路线条宽度"
         Height          =   255
         Index           =   1
         Left            =   360
         TabIndex        =   7
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label1 
         Caption         =   "线条颜色"
         Height          =   255
         Index           =   4
         Left            =   360
         TabIndex        =   6
         Top             =   840
         Width           =   1095
      End
   End
   Begin MSComDlg.CommonDialog CommonDialog1 
      Left            =   1080
      Top             =   2280
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.CommandButton cmduse 
      Caption         =   "应用"
      Default         =   -1  'True
      Height          =   375
      Left            =   120
      TabIndex        =   2
      Top             =   1440
      Width           =   735
   End
   Begin VB.CommandButton cmdcancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   1920
      TabIndex        =   5
      Top             =   1440
      Width           =   735
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确定"
      Height          =   375
      Left            =   1200
      TabIndex        =   3
      Top             =   1440
      Width           =   735
   End
End
Attribute VB_Name = "FrmLinkSetup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*********************************************************************
'*
'*                本源码完全免费,共交通同仁学习参考                 *
'*                      www.tranbbs.com                              *
'*                   Developed by Yang Ming                          *
'*       Nanjing Institute of City Transportation Planning           *
'*                 请保留本版权信息,谢谢合作                        *
'*                      中国交通技术论坛                             *
'*                                                                   *
'*                                                                   *
'*********************************************************************
Private Sub Cmdcancel_Click()
    Unload Me
End Sub

Private Sub cmdok_Click()
        
    If cmduse.Enabled = False Then
        Unload Me
    ElseIf cmduse.Enabled = True Then
        cmduse_Click
        Unload Me
    End If
    
End Sub


Private Sub cmduse_Click()

    

    cmduse.Enabled = False
    cmdok.SetFocus
    
    Dim FtrLink As Feature
    Dim FtrLinks As Features
    Dim LyrLink As Layer
    
    Set LyrLink = Main.Mapshow.Layers("Link")
    Load FrmProgress
    FrmProgress.Show
    
    If LyrLink.AllFeatures.Count <> 0 Then
        step = 100 / LyrLink.AllFeatures.Count
    End If
    Dim Proval
    Proval = step
    
    Dim Ptas() As Points
    LinkWidth = Val(Text1.Text)
    LinkColor = Label2.BackColor
    
    For Each FtrLink In LyrLink.AllFeatures
    
                ReDim Ptas(1 To FtrLink.Parts.Count) As Points
                Dim i, j, partnum
                
                partnum = FtrLink.Parts.Count
                For i = 1 To FtrLink.Parts.Count
                    Set Ptas(i) = FtrLink.Parts.Item(i)
                Next i
                
                Dim Pta As New Point
                Dim ps As New Points
                Dim DrawLine As mapxlib.Feature
                Dim Ftr As mapxlib.Feature
                ps.RemoveAll
                
                For i = 1 To partnum
                    For j = 1 To Ptas(i).Count
                        Pta.Set Ptas(i).Item(j).x, Ptas(i).Item(j).y
                        ps.Add Pta
                    Next j
                Next i

                    Set Ftr = Main.Mapshow.FeatureFactory.CreateLine(ps)
                    Ftr.Style.LineStyle = 1
                    Ftr.Style.LineWidth = LinkWidth
                    Ftr.Style.LineColor = LinkColor
                    Set DrawLine = LyrLink.AddFeature(Ftr)
                
                '读出原有属性,删掉原有节点
                Dim KeyVal
                KeyVal = FtrLink.KeyValue
                LyrLink.DeleteFeature FtrLink
                LyrLink.Refresh
                
                LyrLink.KeyField = "LinkId"
                DrawLine.KeyValue = KeyVal
                DrawLine.Update
        
        Progress Proval, "正在修改路段属性,请稍候..."
        Proval = Proval + step
    Next
    
    
    Open ProjectPath & "setup.ini" For Output As #1
        Write #1, NodeRadius, NodeColor, LinkWidth, LinkColor
    Close #1
    
    Unload FrmProgress
       

End Sub

Private Sub Form_Load()

On Error GoTo Myerr
  
    Text1.Text = LinkWidth
    Label2.BackColor = LinkColor
    
    cmduse.Enabled = False
    cmdok.Enabled = False

    Exit Sub
    
Myerr:
    MsgBox "设置文件丢失,请确保项目文件的完整性!"
    Close #1
    Exit Sub

End Sub

Private Sub Label2_Click()

    cmduse.Enabled = True
   '将 Cancel 设置成 True。
   CommonDialog1.CancelError = True
   On Error GoTo ErrHandler
   '设置 Flags 属性。
   CommonDialog1.Flags = cdlCCRGBInit
   '显示“颜色”对话框。
   CommonDialog1.ShowColor
   '将窗体的背景颜色设置成选定的
   '颜色。
   Label2.BackColor = CommonDialog1.Color
    
    cmduse.Enabled = True
    cmdok.Enabled = True
   
   Exit Sub

ErrHandler:
   '用户按了“取消”按钮。
   Exit Sub

End Sub

Private Sub Text1_Change()
    
    cmduse.Enabled = True
    cmdok.Enabled = True

    
End Sub

⌨️ 快捷键说明

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