Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
adjust for dpi settings
#1
Is there a simple way to adjust a dialog's text and images in case the user has dpi different than 96?
#2
To adjust text size, log off/on Windows. To adjust images, there isn't a simple way.
#3
what about a way to have the dialog not use dpi settings and display at 96dpi?
#4
These items are automatically resized or not:
1. Dialog font size - yes.
2. Size/position of dialog controls and dialog itself - yes.
3. Images - no.

Which of these items you want to resize (make bigger when DPI>69), and which should be always the same size?
#5
im am once again revisiting this topic

i have i dialog that uses gdi+ to draw text and when the dpi text scaling is anything over 100% the text positions are all messed up


text scaling 100%
   


text scaled 125%
   

How to fix the text so it displays where i want it to when text scaling is 100%?
do any of the qm dpi functions help me solve this problem? or are their any other solutions?
any advice would be appreciated
#6
Try
when drawing a text string
Macro Macro3050
Code:
Select All      Help
POINT p.x=100; p.y=100 ;;example: text coordinates at 100% text size

POINT pScaled=p
DpiScale pScaled 1
out F"{pScaled.x} {pScaled.y}"
;then draw text at point pScaled

Or let Windows auto-scale windows of your program. For it need to edit .manifest file of your .exe file: remove the XML that makes the program DPI-aware. But it creates other problems: 1. The window may not look so good. 2. Cannot be used many QM functions that automate other windows. 3. Maybe more.
#7
thanks for your reply  . i see i had a typo on my question

Should have been
How to fix the text so it displays where i want it to when text scaling is not 100%?
also i am using GDIP.RectF coordinates for the text in my dialog .
for example
GDIP.RectF r
r.X=20; r.Y=10
how should i convert these?
other RectF constructors PointF, Real, or some other way?
or redo all the coordinates in Point?
#8
Function GdipScaleRectF
Code:
Select All      Help
function GDIP.RectF&r

int d=DpiGetDPI; if(d=96) ret
FLOAT* p=+&r; int i
for i 0 4
,p[i]=p[i]*d/96

test
Macro Macro3051
Code:
Select All      Help
GDIP.RectF r
r.X=100; r.Y=100; r.Width=100; r.Height=100
GdipScaleRectF r
sub.outRectF r


#sub outRectF
function GDIP.RectF&r

str x(r.X) y(r.Y) w(r.Width) h(r.Height)
out F"{x} {y} {w} {h}"
#9
Thanks Gintaras its working perfectly 

Have 1 more Question

Im trying to get the width of the client area and then minus the length of a text string from the width  to get the y coordinate as i have 4 lines of text that are drawn on the right side of the window. 

Code:
Select All      Help
RECT r; DpiGetWindowRect hDlg &r 4

but havent been able to sort out how to convert 
Code:
Select All      Help
RECT

 to 
Code:
Select All      Help
GDIP.RectF
#10
r.X=k.left; r.Y=k.top; r.Width=k.right-k.left; r.Height=k.bottom-k.top


Forum Jump:


Users browsing this thread: 1 Guest(s)