class CGXPrintDevice: public CObject
The CGXPrintDevice class maintains printer settings. These printer settings can be modified through the CPrintDialog dialog or by the programmer.
CGXPrintDevice supports serialization and thus print settings can be stored in a document.
CGXPrintDevice also makes it possible to use different printer settings in one application for each view. This is an enhancement to the printer settings provided with MFC.
If you want to maintain the printer settings in a document or in a view, you should override the OnInitialUpdate method of the view and connect the print-device to the view by calling SetPrintDevice.
If you want to specify printer settings in your program code, you need to get the device structures from the CGXPrintDevice object as follows:
CGXPrintDevice* pDevice = GetPrintDevice();
if (pDevice)
{
// Ensure that device info is existent
pDevice->NeedDeviceHandles();
// Now, you can get the device info
LPDEVNAMES pDevNames;
DWORD cbSizeDevNames;
LPDEVMODE pDevMode;
DWORD cbSizeDevMode;
pd->GetDeviceInfo(pDevNames, cbSizeDevNames, pDevMode, cbSizeDevMode);
// Now, you can change this structure
// as documented in the Win31 SDK
// and later call CreateDeviceHandles to apply the changes.
pd->CreateDeviceHandles(pDevNames, cbSizeDevNames, pDevMode, cbSizeDevMode);
delete pDevMode;
delete pDevNames;
}
If you want to change margins, take a look at CGXProperties::SetMargins.
#include <gxall.h>
See Also
CGXView CGXGridParam::SetPrintDevice CGXProperties::SetMargins