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:
![Screen shot showing the PayLayoutControl application.](./bitmaps/e56f4ba2-83a1-4852-b2cd-1055b68df3931.png)
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
Sample: Copy the PageLayoutControl focus map and overwrite the MapControl map
How to load a password-protected document
Sample: Load a map document into the PageLayoutControl
Sample: Use a PageLayoutControl as an overview window
Sample: Modify the appearance of the PageLayoutControl's page
Sample: Print preview using the PageLayoutControl
Sample: Printing with the PageLayoutControl
How to save PageLayoutControl contents to a map document
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit | Engine Runtime |
ArcView | |
ArcEditor | |
ArcInfo |