dpi reading not updating - page 2

 
Lorentzos Roussos #: So if im looking at a font size that is proportionally okay on my screen , at 96 dpi then for another user. with 144 dpi i divide the font size by 1.5 ?

Yes! ...

Forum on trading, automated trading systems and testing trading strategies

Graphical Interfaces and Windows scaling in high res screens.

Fernando Carreiro, 2021.05.30 21:10

Have a look at the documentation regarding the terminal property "TERMINAL_SCREEN_DPI" and also do a search in the forum with that keyword.

TERMINAL_SCREEN_DPI

The resolution of information display on the screen is measured as number of Dots in a line per Inch (DPI).

Knowing the parameter value, you can set the size of graphical objects so that they look the same on monitors with different resolution characteristics.

int

Example of scaling factor calculation:
//--- Creating a 1.5 inch wide button on a screen
int screen_dpi = TerminalInfoInteger(TERMINAL_SCREEN_DPI); // Find DPI of the user monitor
int base_width = 144;                                      // The basic width in the screen points for standard monitors with DPI=96
int width      = (button_width * screen_dpi) / 96;         // Calculate the button width for the user monitor (for the specific DPI)
...
 
//--- Calculating the scaling factor as a percentage
int scale_factor=(TerminalInfoInteger(TERMINAL_SCREEN_DPI) * 100) / 96;
//--- Use of the scaling factor
width=(base_width * scale_factor) / 100;

In the above example, the graphical resource looks the same on monitors with different resolution characteristics. The size of control elements (buttons, dialog windows, etc.) corresponds to personalization settings.

 
Lorentzos Roussos #:

do you mean this setting ?


yes, but your issue is with mt4/5. to use the settings in the modern windows, the gui of mt4/5 has to be told to use it first; ie a gui update of mt4/5 program.

EDIT: you will notice if you change the windows res or 100% to 125% then, only some of the mt4/5 gui changes. Whereas 90% of other programs will increase size of all parts of their gui, without exception.
 
Michael Charles Schefe #:

yes, but your issue is with mt4/5. to use the settings in the modern windows, the gui of mt4/5 has to be told to use it first; ie a gui update of mt4/5 program.

but it detects it after mt5 restarts , so it can read the proper dpi of a user's screen if it can read -even after a restart- the zoomed in dpi .

unless its fixed at 96 (in mt5) and if the user zooms in then it returns 144 ?

that would still work right ? because we will use the "flaw" as a starting point (96) because everyone has it

 
Lorentzos Roussos #:

but it detects it after mt5 restarts , so it can read the proper dpi of a user's screen if it can read -even after a restart- the zoomed in dpi .

unless its fixed at 96 (in mt5) and if the user zooms in then it returns 144 ?

that would still work right ? because we will use the "flaw" as a starting point (96) because everyone has it

agreed. most likely, yes, but your first comment was regarding the initial changing of screen res via windows, prior to restarting mt5.

EDIT: and as your link in your first msg demonstrated, you can change the dpi of mt5 programmaticly as well; albeit the outcome aint predictable, much.
 
Fernando Carreiro #:

Yes! ...

why do you multiply by 100?

ow all ints okay , sorry ignore it

Michael Charles Schefe #:

agreed. most likely, yes, but your first comment was regarding the initial changing of screen res via windows, prior to restarting mt5.

yeah , i was 100% sure that going down on resolution would alter the DPI , that does not happen even with a restart 

 

Lorentzos Roussos #: do you mean this setting ?

At 100%, it is always 96 dpi. So at 125% and 150%, it is 120dpi and 144dpi respectively.

 
Lorentzos Roussos #:why do you multiply by 100?ow all ints okay , sorry ignore it

That was just because the user I originally coded it for at the time wanted it expressed in percentage (probably because that is how Windows expresses it).

You can ignore the 100 and just use it as a ratio which saves on the calculation.

 
Fernando Carreiro #:

At 100%, it is always 96 dpi. So at 125% and 150%, it is 120dpi and 144dpi respectively.

Nice thanks 

So essentially the method is :

It looks good on this screen , what is this screen dpi 

Adapt to fit to that on other screens 

and add the resolution into the mix too somehow

 
Lorentzos Roussos #:

why do you multiply by 100?

ow all ints okay , sorry ignore it

yeah , i was 100% sure that going down on resolution would alter the DPI , that does not happen even with a restart 

hence why i said " outcome aint unpredicable" :D

 
Lorentzos Roussos #So essentially the method is :

It looks good on this screen , what is this screen dpi 

Adapt to fit to that on other screens 

and add the resolution into the mix too somehow

No, just use the DPI. MetaTrader is a classical Windows GUI so it does not use any other metric besides the DPI.