VBA之添加Shape图层

参考DeskTop帮助文档 准备:添加一个Button控件Tools—>Customize—>Commands tab—> UIControl—>IButtonControl在该Button的Click事件中添加以下代码:Dim pWorkspaceFactory As IWorkspaceFactorySet pWorkspaceFactory = New ShapefileWorkspaceFactoryDim pWorkSpace As IFeatureWorkspace’Change ‘e:\street’ to the source location of the shapefile you wish to addSet pWorkSpace = pWorkspaceFactory.OpenFromFile("e:\street", 0)Dim pClass As IFeatureClass’Change polygon to the name of the shapefile you wish to addSet pClass = pWorkSpace.OpenFeatureClass("polygon")Dim pLayer As IFeatureLayerSet pLayer = New FeatureLayerSet pLayer.FeatureClass = pClasspLayer.Name = pClass.AliasNameDim pMxDoc As IMxDocumentSet pMxDoc = ThisDocumentpMxDoc.AddLayer pLayerpMxDoc.ActiveView.PartialRefresh esriViewGeography, pLayer, Nothing 不要因为世态变迁而埋怨,不要因为命运多舛而怨恨.

VBA之添加Shape图层

相关文章:

你感兴趣的文章:

标签云: