Support Forums > General Board

EZP a Print Control

<< < (2/3) > >>

Paul Squires:
Great work Jim! Print Preview control and Grid control are two of the most useful controls for most of my business applications.

James Klutho:
Thanks Paul,Jose and aloberr

Josť Roca:
Hi James,

You must remove the call to EZP_SetProcessDPIAware from EZP.inc. This call must be placed at the beginning of your application, if the application does not use the appropriate manifest.

In EZP_NewDialog you must also set the style DS_SETFONT and then add the font (scaled according the DPI scaling ratio) to the DLGTEMPLATE structure. Otherwise, the dialog will use the system font (8 points) and nothing will scale when you set the process DPI aware.

James Klutho:
@ Jose

I tried to scale the fonts in the dialog controls but not in the way you suggested.  The DLGTEMPLATE thing is so confusing to me and I barely got it running as you probably remember from my plea for help on the Freebasic forum a couple of months ago.  Take a look at the new include file and WM_INITDIALOG message in the dialog callback to see how I scaled and set the fonts for the child controls with a SendMessage WM_SETFONT method which is the how I am use to doing it.  The PowerPoint demo is the test file I was using.

I don't have a high DPI monitor so I am flying blind to what you are seeing.

Thanks for your feedback as always.

Jim

Josť Roca:
@James,

Put the call to SetProcessDPIAware in WinMain, not in a place where is not executed.


--- Code: ---function WinMain ( byval hInstance as HINSTANCE, _
                   byval hPrevInstance as HINSTANCE, _
                   byval szCmdLine as zstring ptr, _
                   byval iCmdShow as integer ) as integer

 EZP_SetProcessDPIAware
 print EZP_IsProcessDPIAware   ' check if it has been set

--- End code ---

In EZP_ControlAdd, you're using


--- Code: ---IF hWnd THEN SendMessage hWnd, WM_SETFONT, SendMessage(cast(HWND,hDlg), WM_GETFONT, 0, 0), 0

--- End code ---

but has you have not set the size of the font for the dialog in the dialog template, the call to WM_SETFONT, SendMessage(cast(HWND,hDlg), WM_GETFONT, 0, 0) will return NULL, that means that it is using the system font.


--- Code: ---IF hWnd THEN SendMessage hWnd, WM_SETFONT, SendMessage(cast(HWND,hDlg), WM_GETFONT, 0, 0), 0
print "Font: ", SendMessage(cast(HWND,hDlg), WM_GETFONT, 0, 0)

--- End code ---

See in the capture how small (half the size) appear the controls in my monitor.

Dialogs don't work like SDK windows. They scale automatically according the size of its font.

Maybe Pierre, that is the only SDK'er that I know that likes dialogs, can help you to properly fill the dialog template.

Almost nobody is paying the due attention to DPI awareness. One day they will regret it and ask for an "easy" solution. You know, there are always "easy" solutions to any problem. What happens is that SDK'er like to complicate things :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version