18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

BUILDING APPLICATIONS WITH ACTIVEX<br />

' Set the line symbol properties.<br />

pOutline.Width = 1.5<br />

pOutline.Color = pColor<br />

' Get the IFillSymbol interface.<br />

Set m_pFillSymbol = New SimpleFillSymbol<br />

' Set the fill symbol properties.<br />

m_pFillSymbol.Outline = pOutline<br />

m_pFillSymbol.Style = esriSFSHollow<br />

End Sub<br />

3. Call the CreateOverviewSymbol subroutine from the Form_Load event before<br />

the TOCControl label editing code.<br />

Private Sub Form_Load()<br />

' Create symbol used on the MapControl.<br />

CreateOverviewSymbol<br />

' Set label editing to manual…<br />

End if<br />

4. The default event interface of the PageLayoutControl is the<br />

IPageLayoutControlEvents. These events do not tell you when the extent of the<br />

map within the data frame changes. To do this you will use the<br />

ITransformEvents interface of the PageLayoutControl focus map. Add the<br />

following code to the PageLayoutControl_OnPageLayoutReplaced event<br />

directly above the load document code.<br />

Private Sub PageLayoutControl1_OnPageLayoutReplaced(ByVal newPageLayout<br />

As Variant)<br />

' Get the IActiveView of the focus map in the PageLayoutControl.<br />

Dim pActiveView As IActiveView<br />

Set pActiveView = PageLayoutControl1.ActiveView.FocusMap<br />

' Trap the ITransformEvents of the PageLayoutControl's focus map.<br />

Set m_pTransformEvents = pActiveView.ScreenDisplay.DisplayTransformation<br />

' Get the extent of the focus map.<br />

Set m_pEnvelope = pActiveView.Extent<br />

' Load the same preauthored map document into the MapControl.<br />

MapControl1.LoadMxFile PageLayoutControl1.DocumentFilename<br />

' Set the extent of the MapControl to the full extent of the data.<br />

MapControl1.Extent = MapControl1.FullExtent<br />

End Sub<br />

5. Add the following code to the m_pTransformEvents_VisibleBoundsUpdated<br />

event. This event is triggered whenever the extent of the map is changed and<br />

is used to set the envelope to the new visible bounds of the map. By refreshing<br />

the MapControl you force it to redraw the shape on its display.<br />

Chapter 6 • <strong>Developer</strong> scenarios • 293

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!