Wrong font size in controls - page 2

 
//Based on MQL5\Experts\Examples\Controls\ControlsDialog.mqh 

//+------------------------------------------------------------------+
//| Constructor                                                      |
//+------------------------------------------------------------------+
CUserInterface::CUserInterface(void)
{
        int screen_dpi = TerminalInfoInteger(TERMINAL_SCREEN_DPI); // Find DPI of the user monitor
        dDPIAdjustment = screen_dpi / 120;                      //120 is my main monitor's value
}

//+------------------------------------------------------------------+
//| Create the display field                                         |
//+------------------------------------------------------------------+
bool CUserInterface::CreateEdit(void)
{
//--- coordinates
        int x1 = (int) MathRound(INDENT_LEFT * dDPIAdjustment);
        int y1 = (int) MathRound(INDENT_TOP * dDPIAdjustment);
        int x2 = (int) MathRound(( ClientAreaWidth() - INDENT_RIGHT ) );                //CDialog::ClientAreaWidth() - Gets the width of the control client area
        int y2 = (int) MathRound( y1 + EDIT_HEIGHT );
}

Of course this is not enough because different screen resolutions and especially font scaling greater than 100% can mess it up.