I hope the branch is not dead. I have the following problem: I have a 4k monitor, hence in Windows my font is enlarged (200% size). When making text objects for indicators, the text size is taken from Windows settings and also scaled, as a result if I do something that looks normal on a normal system, on my computer the text overlaps each other, and if I do normal for me, on normal settings the text is too small. I have made a setting in the indicator to let the user choose whether it is scaled or not, but I don't really like it.
Is there any way to know directly from program what font is currently in windows (enlarged or not) and make this correction in code, without touching the users? Just some people may have 4k monitor with scaled text and most of indicators (where text is used) from market looks ugly and ugly.
Olga Miakhovich: I hope the thread isn't dead. I have the following problem: I have a 4k monitor, hence in Windows I have an enlarged font (size 200%). When you make text objects for indicators, the text size is taken from Windows settings and is also scaled, as a result, if you make something that looks normal on a normal system, on my computer the text overlaps each other, and if you make it normal for me, then on normal settings the text is too small. I have made a setting in the indicator to let the user choose whether it is scaled or not, but I don't really like it.
Is there any way to know directly from program what font is currently in windows (enlarged or not) and make this correction in code, without touching the users? Some people may have 4k monitor with scaled text and most of indicators (where text is used) from market looks ugly.
Maybe you should switch to working with resources, or CCanvas?
Then you can set the font size there according to the settings of the operating system.
Устанавливает шрифт для вывода текста методами рисования и возвращает результат успешности этой операции. По умолчанию используется шрифт Arial и размер -120 (12 pt). [in] Размер шрифта, который может задаваться положительными и отрицательными значениями. При положительных значениях размер выводимого текста не зависит от настроек размеров...
That's it, solution found. For those who are wondering what it is: UseTerminalInfoInteger(TERMINAL_SCREEN_DPI) function; With standard scaling it will be 96. If 2 times bigger, then the scaling will be 2 times accordingly.
Olga Miakhovich: That's it, the solution is found. For those wondering what it is: Use the TerminalInfoInteger(TERMINAL_SCREEN_DPI) function; With standard scaling it will be 96. If 2 times bigger, then the scaling will be 2 times accordingly.
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 screenint screen_dpi = TerminalInfoInteger(TERMINAL_SCREEN_DPI); // Find DPI of the user monitorint base_width = 144; // The basic width in the screen points for standard monitors with DPI=96int width = (button_width * screen_dpi) / 96; // Calculate the button width for the user monitor (for the specific DPI)
...
//--- Calculating the scaling factor as a percentageint 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.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I hope you're friends)
"War of the Titans" is not going to happen.
Is there any way to know directly from program what font is currently in windows (enlarged or not) and make this correction in code, without touching the users? Just some people may have 4k monitor with scaled text and most of indicators (where text is used) from market looks ugly and ugly.
I hope the thread isn't dead. I have the following problem: I have a 4k monitor, hence in Windows I have an enlarged font (size 200%). When you make text objects for indicators, the text size is taken from Windows settings and is also scaled, as a result, if you make something that looks normal on a normal system, on my computer the text overlaps each other, and if you make it normal for me, then on normal settings the text is too small. I have made a setting in the indicator to let the user choose whether it is scaled or not, but I don't really like it.
Is there any way to know directly from program what font is currently in windows (enlarged or not) and make this correction in code, without touching the users? Some people may have 4k monitor with scaled text and most of indicators (where text is used) from market looks ugly.
Maybe you should switch to working with resources, or CCanvas?
Then you can set the font size there according to the settings of the operating system.
Read about TextOut(), TextSetFont()
That's it, the solution is found. For those wondering what it is: Use the TerminalInfoInteger(TERMINAL_SCREEN_DPI) function; With standard scaling it will be 96. If 2 times bigger, then the scaling will be 2 times accordingly.
The solution is in the help
Example of calculating the scaling factor:
The solution is in the help
Yeah, but it's not for fonts.
That's it, the solution is found.
really? does scaling affect monitor dpi?
Forum on trading, automated trading systems and trading strategies testing
Peculiarities of mql5 language, tips and tricks
fxsaber, 2019.02.19 22:28
You see the position opened and closed at the same price. But their prices are not equal when compared without normalisation!