In this topic
- About the PageLayoutControl
- Loading map documents
- Saving map documents
- Managing elements
- Printing tasks
About the PageLayoutControl
The PageLayoutControl corresponds to the layout view in ArcMap and encapsulates the PageLayout object. Map documents authored with ArcMap can be loaded into the PageLayoutControl, eliminating the need to programmatically compose the cartography. See the following screen shot of the PageLayoutControl application:
Loading map documents
The map document can be set at design time through the PageLayoutControl property pages (in development environments that support property page capability), and the PageLayoutControl can be set to link or contain the map document.
- When linking, the PageLayoutControl reads the map document when the PageLayoutControl is created on the container, and displays the most recent updates to the map document.
- When containing, the PageLayoutControl copies the contents of the map document into the PageLayoutControl and does not display further updates made to the map document from that point forward. Containing increases the size of the application's executable containing the PageLayoutControl.
Alternatively, a map document can be loaded into the PageLayoutControl programmatically using the CheckMxFile method to determine whether the document is valid and the LoadMxFile method to load the map document.
Saving map documents
The PageLayoutControl can read and write map documents (*.mxd). The PageLayoutControl implements IMxdContents, which enables the MapDocument object to write the contents of the PageLayoutControl to a new map document. See the following code example:
[C#] IMapDocument mapDocument=new MapDocumentClass();
mapDocument.New(@"C:\Temp\myDocument.mxd");
mapDocument.ReplaceContents((IMxdContents)axPageLayoutControl1.Object);
mapDocument.SetActiveView(axPageLayoutControl1.ActiveView);
mapDocument.Save(true, true);
[VB.NET] Dim pMapDocument As IMapDocument
pMapDocument=New MapDocumentClass
pMapDocument.New("C:\Temp\myDocument.mxd")
pMapDocument.ReplaceContents(AxPageLayoutControl1.Object)
pMapDocument.SetActiveView(AxPageLayoutControl1.ActiveView)
pMapDocument.Save(True, True)
Managing elements
The PageLayoutControl provides shortcuts to frequently used members, such as, GraphicsContainer and AddElement; and helper methods, such as, FindElementByName and LocateFrontElement, to manage individual elements in the PageLayout.
Printing tasks
The PageLayoutControl provides shortcuts to frequently used members on the PageLayout object, such as, Page and Printer; and helper members, such as, PrinterPageCount and PrintPageLayout, to assist with printing tasks.
See Also:
Controls library overviewWorking with the page layout
How to get started with the PageLayoutControl property pages
How to load a password-protected document
How to save PageLayoutControl contents to a map document
Samples:
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine |
ArcGIS for Desktop Basic | |
ArcGIS for Desktop Standard | |
ArcGIS for Desktop Advanced |