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 WINDOWS CONTROLS<br />

m_ToolbarMenu.AddItem(progID, -1, -1, false,<br />

esriCommandStyles.esriCommandStyleIconAndText);<br />

progID = "esriControlToolsPageLayout.ControlsPageZoomWholePageCommand";<br />

m_ToolbarMenu.AddItem(progID, -1, -1, false,<br />

esriCommandStyles.esriCommandStyleIconAndText);<br />

progID =<br />

"esriControlToolsPageLayout.ControlsPageZoomPageToLastExtentBackCommand";<br />

m_ToolbarMenu.AddItem(progID, -1, -1, true,<br />

esriCommandStyles.esriCommandStyleIconAndText);<br />

progID =<br />

"esriControlToolsPageLayout.ControlsPageZoomPageToLastExtentForwardCommand";<br />

m_ToolbarMenu.AddItem(progID, -1, -1, false,<br />

esriCommandStyles.esriCommandStyleIconAndText);<br />

// Set the hook to the PageLayoutControl.<br />

m_ToolbarMenu.SetHook(axPageLayoutControl1);<br />

// Load a preauthored…<br />

}<br />

3. Display the form in design mode, select axPageLayoutControl1 from the<br />

Properties window, and display the axPageLayoutControl events. Doubleclick<br />

the OnMouseDown event to add an event handler to the code window.<br />

4. In the axPageLayoutControl_OnMouseDown event, add the following code:<br />

private void axPageLayoutControl1_OnMouseDown(object sender,<br />

ESRI.<strong>ArcGIS</strong>.PageLayoutControl.IPageLayoutControlEvents_OnMouseDownEvent<br />

e)<br />

{<br />

// Popup the ToolbarMenu.<br />

if (e.button == 2)<br />

{<br />

m_ToolbarMenu.PopupMenu(e.x,e.y,axPageLayoutControl1.hWnd);<br />

}<br />

}<br />

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