MapControl.ShowPrintPreview() Method
Invokes the Print Preview Form, which shows the print preview of the map control.
Namespace: DevExpress.XtraMap
Assembly: DevExpress.XtraMap.v18.2.dll
Declaration
Remarks
The Print Preview form displays the map as it will appear when printed. To print the map, use the MapControl.Print method and to export it, use the appropriate ExportTo~ method (e.g., MapControl.ExportToPdf, etc.)
Note
The map control can be previewed, printed or exported only if the XtraPrinting Library is available.
Example
To print a map, use one of the following methods.
MapControl.ShowPrintPreview
- invokes the Print Preview Form;- MapControl.ShowRibbonPrintPreview - invokes the Print Preview Form with the Ribbon bar;
- MapControl.ShowPrintDialog - invokes the standard Print Dialog.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-print-or-export-a-map-t185956
private void ddbPrint_Click(object sender, EventArgs e) {
switch (printType) {
case (PrintType.Preview):
mapControl.ShowPrintPreview();
break;
case (PrintType.RibbonPreview):
mapControl.ShowRibbonPrintPreview();
break;
case (PrintType.Dialog):
mapControl.ShowPrintDialog();
break;
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowPrintPreview() method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.