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

📄 vba14-2.txt

📁 vb.net的开发及应用程序属性查询及应用程序属性查询
💻 TXT
字号:
Private Function LoadShapefile(strPath As String, _
strFile As String, strName As String) As ILayer
    ' Load the shapefile based on the given path and name.
    ' Shapefile is added to the focus map as a layer.
    ' Layer is returned when successful.
    Dim pWorkspaceFactory As IWorkspaceFactory
    Dim pFeatureWorkspace As IFeatureWorkspace
    Dim pFeatureClass As IFeatureClass
    Dim pFeatureLayer As IFeatureLayer
    Dim pMxDocument As IMxDocument
    Dim pMap As IMap
    Set pWorkspaceFactory = New ShapefileWorkspaceFactory
    Set pFeatureWorkspace = pWorkspaceFactory. _
    OpenFromFile(strPath, 0)
    Set pFeatureClass = pFeatureWorkspace. _
    OpenFeatureClass(strFile)
    Set pFeatureLayer = New FeatureLayer
    Set pFeatureLayer.FeatureClass = pFeatureClass
    ' Set the name and visibility of the layer.
    pFeatureLayer.Name = strName
    pFeatureLayer.Visible = True
    ' Add the shapefile to the focus map.
    Set pMxDocument = Application.Document
    Set pMap = pMxDocument.FocusMap
    pMap.AddLayer pFeatureLayer
    Set LoadShapefile = pFeatureLayer
End Function

⌨️ 快捷键说明

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