Strange DPI-conscious behavior, as an example at 120% Sca

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Strange DPI-conscious behavior, as an example at 120% Sca

Post by Saki »

Hi all

Strange behavior.
Please test it once.
For example, if the Windows 10 scaling is set to 120% (also various enhanced other scales),
Process is DPI aware, even if it is disabled in the PB Compiler options !

Best regards Saki
Last edited by Saki on Fri May 22, 2020 9:08 pm, edited 2 times in total.
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: Strange DPI-conscious behavior, as an example at 120% Sc

Post by Saki »

I forgot to write a sample.

You can test it with this code :

Code: Select all

library=OpenLibrary(#PB_Any, "user32.dll")
If library
  If CallFunction(library, "IsProcessDPIAware")
    CloseLibrary(library)
    Debug "Process is DPI aware"
  Else
    Debug "Process is not DPI aware"
  EndIf
Else
  Debug "Can not open library"
EndIf
Last edited by Saki on Wed May 20, 2020 8:15 pm, edited 2 times in total.
地球上の平和
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Strange DPI-conscious behavior, as an example at 120% Sca

Post by Saki »

It was hard to understand.

But it is now clear what it is, it is only the advanced Windows OS scaling.
The problem is up to scaling 125%
If you use the default scalings, everything is OK and DPI aware is also disabled when it is disabled in the PB compiler options.
This can be due to PB or the OS ?

Anyway, it is a very bad bug which destroys formatting and scaling.

Added a other test code for better understanding the bug :

Code: Select all

Define wID=OpenWindow(#PB_Any, 0, 0, 610, 400, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

Define font=LoadFont(#PB_Any , "Arial" , 26 , #PB_Font_Bold)

StartDrawing(WindowOutput(wID))
DrawText(0 , 10 , "Try scaling 125% with and without DPI aware Compiler option")
DrawText(0 , 30 , "First try the 125% that Windows offers directly in the scaling menu")
DrawText(0 , 50 , "Then switch to the extended scales and enter the 125% by hand again !")
DrawText(0 , 80 , "Compare the results and you will see the bug")

DrawingFont(FontID(font))
DrawText(0 , 120 , "You ever must see this line complete")
StopDrawing()

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow


Best regards Saki
地球上の平和
Post Reply