Im testing the phGantTimePackage3.0 for an eventually use in one of my applications. After trying some features I have a big problem with the “PrintToHdc”-function. The hDC (Device Context) of the printer have a resolution of 300×300 dpi. I get the resolution of the hDC by the following command (in a vba-script)
dpiX = apiGetDeviceCaps(hDC, LOGPIXELSX)
It returns 300.
The PrintToHDC function now returns the correct width and height off the gantt-chart in pixels (e.g. 4000x3000pixels) if it would be print with a resolution of 300 dpi, but on the print-preview and also on the printout the gantt-chart is printed with the resolution of the display (96x96dpi) and not of the printed-hdc resolution.
The problem is, that the viewable size of the printout is limited to the 4000×3000 pixels, but of the fact that the print was made in a resolution of 96X96 dpi the print shoult be much bigger. But only a small part of the printout (4000×3000 pixel) is seen.
You need to adjust the scale you send into the PrintToHdc. In Yapp the project calculator we use aScale=dpiX/100. This gives a scale of aproximatly 1 (0,96) for the screen preview, and on a 300 dpi printer the scale will be 3. This will give you the same degree of detail for screen and paper, but with higher resolution on the paper.