18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

BUILDING APPLICATIONS WITH ACTIVEX<br />

' Set the symbol properties.<br />

pTextSymbol.Font = pFont<br />

' Set the text element properties.<br />

pTextElement.Symbol = pTextSymbol<br />

pTextElement.Text = Date<br />

' QI for IElement<br />

Dim pElement As IElement<br />

Set pElement = pTextElement<br />

' Create a page point.<br />

Dim pPoint As IPoint<br />

Set pPoint = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(x, y)<br />

' Set the elements geometry.<br />

pElement.Geometry = pPoint<br />

' Add the element to the graphics container.<br />

pActiveView.GraphicsContainer.AddElement pTextElement, 0<br />

' Refresh the graphics.<br />

pActiveView.PartialRefresh esriViewGraphics, Nothing, Nothing<br />

End Sub<br />

Private Sub ITool_OnMouseMove(ByVal button As Long, ByVal shift As Long,<br />

ByVal x As Long, ByVal y As Long)<br />

' Not implemented<br />

End Sub<br />

Private Sub ITool_OnMouseUp(ByVal button As Long, ByVal shift As Long,<br />

ByVal x As Long, ByVal y As Long)<br />

' Not implemented<br />

End Sub<br />

Private Sub ITool_Refresh(ByVal hdc As esriSystem.OLE_HANDLE)<br />

' Not implemented<br />

End Sub<br />

11. You now need to compile your project into an ActiveX DLL. Give it the<br />

name ControlCommands.dll.<br />

12. Register the ControlCommands.dll.<br />

13. In the Visual Basic Standard executable project that you created at the beginning<br />

of this scenario, select the Form_Load event and add the following code<br />

after the code to add the map navigation commands.<br />

Private Sub Form_Load()<br />

' Add Map navigation commands…<br />

' Add custom date tool.<br />

sProgID = "<strong>Engine</strong>ScenarioCommands.AddDateTool"<br />

ToolbarControl1.AddItem sProgID, , , True, , esriCommandStyleIconAndText<br />

298 • <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!