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

' Create a new ToolbarMenu…<br />

End Sub<br />

14. Run the application and use the AddDateTool to add a text element to the<br />

PageLayoutControl containing today’s date.<br />

Customizing the ToolbarControl<br />

In addition to adding control commands and tools to the ToolbarControl in the<br />

Form_Load event, you can also add them by customizing the ToolbarControl and<br />

using the Customize dialog box. To do this you will place the ToolbarControl in<br />

customize mode and display the Customize dialog box.<br />

1. Add the following code to the general declarations area of the form:<br />

Option Explicit<br />

Private m_pToolbarMenu As IToolbarMenu<br />

Private m_pEnvelope As IEnvelope<br />

Private m_pFillSymbol As IFillSymbol<br />

Private WithEvents m_pTransformEvents As DisplayTransformation<br />

Private WithEvents m_pCustomizeDialogEvents As CustomizeDialog<br />

' The customize dialog events<br />

Private m_pCustomizeDialog As ICustomizeDialog<br />

' The customize dialog box<br />

used by the ToolbarControl<br />

2. Add a new subroutine called CreateCustomizeDialog and add the following code<br />

to it. This is where you will create the Customize dialog box. Add the following<br />

code to the subroutine:<br />

Private Sub CreateCustomizeDialog()<br />

Set m_pCustomizeDialog = New CustomizeDialog<br />

Set m_pCustomizeDialogEvents = m_pCustomizeDialog<br />

' Set the title.<br />

m_pCustomizeDialog.DialogTitle = "Customize ToolbarControl Items"<br />

' Show the Add from File button.<br />

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

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

Saved successfully!

Ooh no, something went wrong!