次の方法で共有


CPageSetupDialog Class

Encapsulates the services provided by the Windows common OLE Page Setup dialog box with additional support for setting and modifying print margins.

class CPageSetupDialog : public CCommonDialog

Members

Public Constructors

Name

Description

CPageSetupDialog::CPageSetupDialog

Constructs a CPageSetupDialog object.

Public Methods

Name

Description

CPageSetupDialog::CreatePrinterDC

Creates a device context for printing.

CPageSetupDialog::DoModal

Displays the dialog box and allows the user make a selection.

CPageSetupDialog::GetDeviceName

Returns the device name of the printer.

CPageSetupDialog::GetDevMode

Returns the current DEVMODE of the printer.

CPageSetupDialog::GetDriverName

Returns the driver used by the printer.

CPageSetupDialog::GetMargins

Returns the current margin settings of the printer.

CPageSetupDialog::GetPaperSize

Returns the paper size of the printer.

CPageSetupDialog::GetPortName

Returns the output port name.

CPageSetupDialog::OnDrawPage

Called by the framework to render a screen image of a printed page.

CPageSetupDialog::PreDrawPage

Called by the framework before rendering a screen image of a printed page.

Public Data Members

Name

Description

CPageSetupDialog::m_psd

A structure used to customize a CPageSetupDialog object.

Remarks

This class is designed to take the place of the Print Setup dialog box.

To use a CPageSetupDialog object, first create the object using the CPageSetupDialog constructor. Once the dialog box has been constructed, you can set or modify any values in the m_psd data member to initialize the values of the dialog box's controls. The m_psd structure is of type PAGESETUPDLG.

After initializing the dialog box controls, call the DoModal member function to display the dialog box and allow the user to select print options. DoModal returns whether the user selected the OK (IDOK) or Cancel (IDCANCEL) button.

If DoModal returns IDOK, you can use several of CPageSetupDialog's member functions, or access the m_psd data member, to retrieve information input by the user.

Note

After the common OLE Page Setup dialog box is dismissed, any changes made by the user will not be saved by the framework. It is up to the application itself to save any values from this dialog box to a permanent location, such as member of the application's document or application class.

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CDialog

CCommonDialog

CPageSetupDialog

Requirements

Header: afxdlgs.h

See Also

Reference

CCommonDialog Class

Hierarchy Chart

Concepts

MFC Sample WORDPAD