Opening a published map with the ArcReaderControl
The following steps demonstrate how to get started with the ArcReaderControl by using the Property Pages dialog box tabs supplied with the control and some of the objects exposed by the ArcReaderControl object model. Follow the steps to produce a fully functional Visual Basic application in only a few minutes.
- Start Visual Basic and create a new Standard EXE project from the New Project dialog box.
- Click the Project menu, click Components, click ESRI ArcReaderControl, then click OK.
- Click the ArcReaderControl icon in the Visual Basic toolbox to place the ArcReaderControl on a form, then click and drag from one corner to the opposite corner. Alternatively, double-click the ArcReaderControl icon in the Visual Basic toolbox, and the ArcReaderControl will automatically be placed on the form. Rearrange the control position and resize the control to be similar to that shown below.
- Right-click the ArcReaderControl and click Properties to open the ArcReaderControl Property Pages dialog box. Click the General tab, then click the browse document button . Navigate to a folder containing a .pmf document of your choice and highlight it. (Be sure the .pmf you choose was published with permission to load into a customized ArcReader application.) Click the Open button, then click Apply on the Property Pages dialog box to link the .pmf in the ArcReaderControl.
- Click the View tab and choose Map Identify from the Map Default tool drop-down list, then choose Layout Zoom In from the Page Layout Default tool drop-down list and click Apply.
- Click OK to close the ArcReaderControl Property Pages dialog box.
- Add a command button to the form with the name cmdFullExtent and the caption Full Extent. Position the command button to be similar to that shown below.
- Double-click the Full Extent button to display its click event in the code window. Enter or copy the following code into the click event as shown below.
Click the Run menu and click Start, or press F5, to start the application. Toggle layer visibility by interacting with the check boxes in the table of contents. Use the Layout Zoom In tool in layout view to navigate around the page. Use the Map Identify tool in map view to identify features in the focus map and navigate around them. Click Full Extent to zoom to the full extent of the data or the full extent of the page, depending on the current view.
The control will now appear in the Visual Basic toolbox .
'If the current view is a page layout zoom to the whole page If ArcReaderControl1.CurrentViewType = esriARViewTypePageLayout Then ArcReaderControl1.ARPageLayout.ZoomToWholePage 'If the current view is a map (data view) zoom to the full extent of the data ElseIf ArcReaderControl1.CurrentViewType = esriARViewTypeMap Then ArcReaderControl1.ARPageLayout.FocusARMap.ZoomToFullExtent End If
- Map publishers can create maps that are not usable in a custom ArcReader application. If a map will not open, use the Published Map Information tool to check its properties. The Published Map Information tool is part of the ArcGIS Desktop Developer Kit installation.
- Your compiled executable can be delivered to and used by anyone with the same or a newer version of ArcReader.