Поделиться через


CPageSetupDialog::OnDrawPage

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

virtual UINT OnDrawPage(
   CDC* pDC,
   UINT nMessage,
   LPRECT lpRect 
);

Parameters

  • pDC
    Pointer to the printer device context.

  • nMessage
    Specifies a message, indicating the area of the page currently being drawn. Can be one of the following:

    • WM_PSD_FULLPAGERECT   The entire page area.

    • WM_PSD_MINMARGINRECT   Current minimum margins.

    • WM_PSD_MARGINRECT   Current margins.

    • WM_PSD_GREEKTEXTRECT   Contents of the page.

    • WM_PSD_ENVSTAMPRECT   Area reserved for a postage stamp representation.

    • WM_PSD_YAFULLPAGERECT   Area for a return address representation. This area extends to the edges of the sample page area.

  • lpRect
    Pointer to a CRect or RECT object containing the coordinates of the drawing area.

Return Value

Nonzero value if handled; otherwise 0.

Remarks

This image is then displayed as part of the common OLE Page Setup dialog box. The default implementation draws an image of a page of text.

Override this function to customize the drawing of a specific area of the image, or the entire image. You can do this by using a switch statement with case statements checking the value of nMessage. For example, to customize the rendering of the contents of the page image, you could use the following example code:

switch(nMessage)
{
    case WM_PSD_GREEKTEXTRECT:
      DrawMyImage(pDC, lpRect);    //draws my special graphic
      return 1;
    default:
      return CPageSetupDialog::OnDrawPage(pDC, nMessage, lpRect);
}

Note that you do not need to handle every case of nMessage. You can choose to handle one component of the image, several components of the image, or the whole area.

Requirements

Header: afxdlgs.h

See Also

Reference

CPageSetupDialog Class

Hierarchy Chart

CPageSetupDialog::PreDrawPage

Other Resources

CPageSetupDialog Members