Questions about DPI aware

Just starting out? Need help? Post your questions and find answers here.
MinerDac
User
User
Posts: 11
Joined: Sat Jul 13, 2024 12:02 pm

Questions about DPI aware

Post by MinerDac »

If the DPI aware thing is enabled in compiler options does that mean the produced window will scale according to the Windows 10 desktop settings?

For example: desktop is 1920 x 1080 @125%. If I make a window, say, 1000 x 540 at that desktop resolution - if I change the desktop to 1920 x 1080 @100% will my code produced window scale or is there something else I need to do?

I've searched through the forum and found all sorts of things on this subject goi0ng back years to more present day, and I'm more confused over it now.

Do I need to do something like the below with the DPI aware enabled in the compiler settings ...

Code: Select all

dpi=GetDeviceCaps_(GetDC_(0),#LOGPIXELSX)
res.d=dpi/96

OpenWindow(0,200,200,1000*res,540*res,"test",#PB_Window_SystemMenu)

x=10*res
w=110*res
h=20*res

TextGadget(1,x,10*res,w,h,"some text here")
StringGadget(2,x,40*res,w,h,"some text here")
ButtonGadget(3,x,70*res,w,h,"some text here")

Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
?
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Questions about DPI aware

Post by Fred »

No, all is automatic. The exception are the pixel based component (image/canvas) as it scales as well in pixel, so you need to adjust their content.
Post Reply