'Mapクラスのインスタンスを作成するだけでは、データフレームのプロパティが表示されず、レイアウト ビューにも追加されない。Developer Helpのサンプルに記載の操作が必要。 'IMap Interface Example Public Sub AddDataFrame() Dim pContentsView As IContentsView Dim pApp As IMxApplication Dim pMap As IMap Dim pMaps As IMaps Dim pMxDocument As IMxDocument Dim pActiveView As IActiveView Set pApp = Application Set pMxDocument = ThisDocument Set pActiveView = pMxDocument.ActiveView Set pMaps = pMxDocument.Maps Set pMap = pMaps.Create pMaps.Add pMap Set pContentsView = pMxDocument.CurrentContentsView pContentsView.Refresh pMxDocument Dim pMapFrame As IMapFrame Dim pMapExt As IEnvelope Set pMapFrame = New MapFrame Set pMapExt = New Envelope Set pMapFrame.Map = pMap pMapExt.XMin = 3 pMapExt.YMin = 3 pMapExt.XMax = 7 pMapExt.YMax = 7 Dim pMapElement As IElement Dim pGeoExt As IGeometry Set pMapElement = pMapFrame Set pGeoExt = pMapExt pMapElement.Geometry = pGeoExt If pActiveView.IsMapActivated Then Set pMxDocument.ActiveView = pMap Dim pGraphicsContainer As IGraphicsContainer Set pGraphicsContainer = pMxDocument.PageLayout pGraphicsContainer.AddElement pMapElement, 2 Else pActiveView.GraphicsContainer.AddElement pMapElement, 2 pMapElement.Activate pApp.Display End If pActiveView.Refresh End Sub
Map を新規に作成する方法
2016/9/1 (木)