srod wrote:If you set your display to 125% DPI then you need to divide by 120 (the actual DPI) not 125. You're still confusing a % scale factor with an actual DPI.

srod wrote:If you set your display to 125% DPI then you need to divide by 120 (the actual DPI) not 125. You're still confusing a % scale factor with an actual DPI.
@Fred : I think this is a problem with the non-linear scaling of text extents which I am encountering. I have tested this under GDI and GDI+ and the result is the same. It is making simple DPI scaling unsuited (or insufficient) for some static-text based gadgets if the desired end result is to have the gadget's resize just enough to contain the static text. I don't think we can escape from utilising good old fashioned TextWidth() calculations for these gadgets in these circumstances - which is something I generally do anyhow. If I am right then, well, I think DPIAware needs a bit of a rethink because there seems to be no escaping this problem. Unless I am missing something of course... which is more than possible!Fred wrote:I will take a look
Code: Select all
;TODO :let Compiler not use DPI ,then test this:
dpi=GetDeviceCaps_(GetDC_(0),#LOGPIXELSX)
zoom.d=dpi/96
Debug "dpi="+dpi
Debug "zoom="+zoom
OpenWindow(0,200,200,180*zoom,100*zoom,"test",#PB_Window_SystemMenu)
x=10*zoom
w=155*zoom
h=20*zoom
TextGadget(1,x,10*zoom,w,h,"This is text that fills the gadget",#PB_Text_Border)
StringGadget(2,x,40*zoom,w,h,"Another small test of fitted text")
ButtonGadget(3,x,70*zoom,w,h,"And last example of exact text")
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
; IDE Options = PureBasic 5.71 LTS (Windows - x86)
; CursorPosition = 9
; EnableXP
That of course will destroy the appearance of GUI layouts, itself a nightmare.need to size gadgets (or some of them at least) after first examining TextWidth() or GadgetWidth(..., #PB_Gadget_RequiredSize) etc.