Aarcgisprosdk10.8 Release
5ac5058d创建于 2020年2月21日历史提交
文件最后提交记录最后更新时间
6 年前
6 年前
9 年前
6 年前
6 年前
README
This sample demonstrates changing the printer and printer settings and applying the changes to the PageLayoutControl and its print preview. The sample uses .NET OpenFileDialog, PageSetupDialog, PrintPreviewDialog, and PrintDialog to load a map document into the PageLayoutControl, change the printer settings, display a print preview, and print the IPageLayoutControl.Page property, respectively. The terminology used is as follows:
  • Print page—A page that is displayed in the Print Preview dialog box or printed to a physical printer.
  • Device boundaries—The boundaries of the page to which the map document is printed.
  • Visible boundaries—The area of the map document that fits on the print page.
  • Graphics device—Encapsulates a graphical device interface (GDI) drawing surface, provides methods for drawing objects to the display device, and is associated with a specific device context.
Language:              C#, VB
Subject:               Controls
Organization:          Esri, http://www.esri.com
Date:                  10/17/2019
ArcObjects SDK:        10.8
Visual Studio:         2017, 2019
.NET Target Framework: 4.5

Resources

Usage

  1. Browse and select a map document to load into the PageLayoutControl.
  2. Select a printer and change the page settings in the Page Setup dialog box.
  3. Preview the print layout of the map in the Print Preview dialog box.
  4. Print the document using the Print dialog box.

Additional information

After loading a map document into the PageLayoutControl using OpenFileDialog, select a printer and change the page settings using PageSetupDialog. PrintPreviewDialog displays IPageLayoutControl.Page as print pages dependent upon the selected printer and the page settings. The key functionality is implemented in the document_PrintPage event handler, which is called when PrintPreviewDialog appears.
 
First, the IPage.PageToPrinterMapping property is set with the selected index from the combo box. The combo box allows you to specify the way the IPageLayoutControl.Page property is mapped to the print pages. The following options are available:
Second, the device boundaries (devBounds) of the printer, as well as the visible boundaries (visBounds) of the map document, are obtained using the selected printer properties.
 
IPageLayoutControl.Page is printed into PrintPreviewDialog using the Output method of the PageLayoutControl.ActiveView. In addition to the graphics device's resolution (dpi), device boundaries (devBounds), visible boundaries (visBounds), and CancelTracker, the method gets passed a handle to the graphics device to which the map document is printed. This graphics device handle is obtained by calling GetHdc on the graphics object that gets passed within the method's argument structure. Calls to the GetHdc and ReleaseHdc methods must appear in pairs. If ReleaseHdc is not called, the application will fail with an exception.
 
If the map document is to be mapped to more than one page, the HasMorePages property of the document_PrintPage's argument is set to true. This ensures that document_PrintPage will be called again. This is repeated until the last page is printed to PrintPreviewDialog. The document can then be printed using PrintDialog.

See Also

PageLayoutControl class
IPageLayoutControl interface


Licensing

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS Desktop Basic
ArcGIS Desktop Standard
ArcGIS Desktop Advanced