PtrDevice:PrinterDeviceContext Access

<< Click to Display Table of Contents >>

Navigation:  RpPrinter & PtrDevice Class Overview > PtrDevice Class >

PtrDevice:PrinterDeviceContext Access

Previous pageReturn to chapter overviewNext page
Type        HDC                (16-bit: WORD, 32-bit PTR)

Purpose

To retrieve the printer device context during a Print() or PrintPreview().  At the beginning of a print preview, the PtrDevice creates a print preview memory context and a device context for the current printer.  The printer device context is provided to allow you to retrieve font information from the printer driver so that text can be placed in the print preview window as it would appear on the printer.  During a print operation, this access returns PtrDevice:DeviceContext.

Example

// Get font information from the printer driver

hDC      := oPtrDevice:PrinterDeviceContext

hOldFont := SelectObject(hDC, hNewFont)

GetTextMetrics(hDC, @sWinTextMetrics)

SelectObject(hDC, hOldFont)

 

Note:        Do not destroy this device context.  It is automatically managed by the PtrDevice class.