//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)
{
//--- coordinatesint 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 areaint 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.
Of course this is not enough because different screen resolutions and especially font scaling greater than 100% can mess it up.