Graphical Interfaces and Windows scaling in high res screens.

 

Hello everybody,

I'm sure this has been discussed before but I can't seem to find the thread where I saw this topic. Could someone point me to a Market product, article or forum thread where the Windows Scale and Layout is considered when creating a graphical interface?

I do remember seeing a product in the Market where there was an input to select which scaling option you had in Windows so the interface can be shown properly, I tried to find it again but I had no luck. Also I remember reading either a thread or forum discussing the topic but well, found it by accident and now that I'm trying to find it on purpose I'm also not having much luck haha.

Any help is appreciated! 

Thanks in advance

-Fernando

 
Fernando Jose Velasco Borea: I'm sure this has been discussed before but I can't seem to find the thread where I saw this topic. Could someone point me to a Market product, article or forum thread where the Windows Scale and Layout is considered when creating a graphical interface? I do remember seeing a product in the Market where there was an input to select which scaling option you had in Windows so the interface can be shown properly, I tried to find it again but I had no luck. Also I remember reading either a thread or forum discussing the topic but well, found it by accident and now that I'm trying to find it on purpose I'm also not having much luck haha.

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.

Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Client Terminal Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Client Terminal Properties
  • www.mql5.com
Client Terminal Properties - Environment State - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Fernando Carreiro #:

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:

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.

Thanks it work...