There are two ways to develop dpi-aware apps. In the first scenario you will need a high-resolution display (> 96 DPI) and run the IDE (GfaWin32.exe) on that display. Because the IDE isn't dpi-aware (when using the default GfaWin32.exe.manifest) the application is scaled back to 96 DPI by Windows automatically. Then use the DpiAwareness command in your program to change dpi-awareness of the GB32 program you are developing. The GFA-BASIC program will run in the dpi-awareness mode set by DpiAwareness, but the IDE isn't. Your forms/windows will appear very small, so the program must handle the dpi-awareness and adjust the window size and everything that it contains, see DpiAwareness and ScaleToDpi in this help on how to do that.
In the second scenario you'll need two monitors: one regular 96 dots-per-inch display to run the GFA-BASIC 32 IDE and one high-resolution display to run and test the program. In addition, the manifest of gfawin32.exe must include the
Note: After renaming the new manifest it may not be recognized by the OS. If so, the date of the EXE (GfaWin32.exe) must be updated to the current date. For this purpose the Bin directory includes a small program TouchExe that will 'touch' the GfaWin32.exe to the current date. After updating the date the OS will apply the new manifest.
After restarting GB the IDE is dpi-aware and will be displayed according to the display's DPI. On a high-resolution display the IDE and its font will be very small. So in practise, the IDE cannot be run on a high-resolution monitor with the dpiAwareness tag in its manifest, hence the need for a second regular monitor to run the IDE. Of course, the IDE can be run on a high-resolution display without the dpiAwareness tag in its manifest. In this case Windows makes sure the application is scaled properly. All programs without the dpiAwareness tag in their manifest are scaled by the OS.
After making the GB32 program dpi-aware the developer is responsible for scaling controls and graphics output. The ScaleToDpi.g32 example (in Samples) shows how to scale Ocx controls properly when the Form is opened or moved to another display with a different DPI. The Samples\WM_DPICHANGED.g32 example shows how to scale the form for graphic output using the ScaleXYWHToDpi command. The application may also use Direct2D to perform draw operations without the need to scale graphics output. Direct2D uses a display independent coordinate system and takes care of the scaling itself.
Next: Direct2D Applications
Back to: Creating An Application.
ScaleToDpi, WM_DPICHANGED, ScaleXYWHToDpi, Direct2D applications.
{Created by Sjouke Hamstra; Last updated: 03/03/2021 by James Gaite}