Print screen content size and actual printing effect match!

zhaozj2021-02-16  50

Method 1: Modify the onpreparedc function

PDC-> setmapmode (mm_anisotropic);

CSIZE SIZE = CSIZE (800, 560);

PDC-> setWindowext (size); // Setting the window size

/ / Get the number of pixels per logical inch

INT XLogpixPerinch =

PDC-> GetDeviceCaps (Logpixelsx);

Int YlogpixPerinch =

PDC-> GetDeviceCaps (Logpixelsy);

// Get the proportion of equipment coordinates and logical coordinates

Long Xext = (long) size.cx * xlogpixperinch / 96;

Long Yext = (long) size.cy * YLOGPIXPERINCH / 96;

PDC-> SetViewPortext (INT) Xext, (int) Yext);

// Set the viewport size

Method 2: Modify OnPrint function

PDC-> setmapemode (Lometric)

nsizex = getDeviceCaps (Horzsize)

nsizey = getDeviceCaps (Vertsize)

// Get physical width

nsizex = nsizex / 0.1

nsizey = nsizey / 0.1

Then you can use the PDC to draw on NSizex.

转载请注明原文地址:https://www.9cbs.com/read-19586.html

New Post(0)