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 />

Private Sub m_pTransformEvents_VisibleBoundsUpdated(ByVal sender As<br />

esriDisplay.IDisplayTransformation, ByVal sizeChanged As Boolean)<br />

' Set the extent to the new visible extent.<br />

Set m_pEnvelope = sender.VisibleBounds<br />

' Refresh the MapControl's foreground phase.<br />

MapControl1.Refresh esriViewForeground<br />

End Sub<br />

6. Add the following code to the MapControl_OnAfterDraw event to draw the<br />

envelope with the symbol you created earlier onto the MapControl display.<br />

Private Sub MapControl1_OnAfterDraw(ByVal display As Variant, ByVal<br />

viewDrawPhase As Long)<br />

If m_pEnvelope Is Nothing Then Exit Sub<br />

' If the foreground phase has drawn<br />

Dim pViewDrawPhase As esriViewDrawPhase<br />

pViewDrawPhase = viewDrawPhase<br />

If pViewDrawPhase = esriViewForeground Then<br />

' Draw the shape on the MapControl.<br />

MapControl1.DrawShape m_pEnvelope, m_pFillSymbol<br />

End If<br />

End Sub<br />

7. Run the application. Use the map navigation tools that you added earlier to<br />

change the extent of the focus map in the PageLayoutControl. The new<br />

extent is drawn on the MapControl.<br />

294 • <strong>ArcGIS</strong> <strong>Engine</strong> <strong>Developer</strong> <strong>Guide</strong>

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

Saved successfully!

Ooh no, something went wrong!