Wrong resolution of second screen lazarus / 34-Windows ---------------------------------------------------------------------- Apiglio · 2024-12-05 12:20 I'm using TScreen.Monitors to get resolution information of Desktop and find the size of Primary Screen is correct but not of the second. Here is my code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   for idx:=0{edited} to Screen.MonitorCount-1 do  begin    writeln(Format('Monitor %d:',[idx]));    writeln(Format('  PPI = %d', [Screen.Monitors[idx].PixelsPerInch]));    with Screen.Monitors[idx].BoundsRect do      writeln(Format('  Boundary: left = %d, top = %d, width = %d, height = %d', [Left, Top, Width, Height]));  end;  Here is my screen setting: Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i +---+------ -+|   |       || 1 |   0   ||   |       |+---+-------+monitor 0:  Resolution: 2560 x 1440  Scaling:   150% monitor 1:  Resolution: 900 x 1440  Scaling:   100% run the code and I got this: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Monitor 0:  PPI = 144  Boundary: left = 0, top = 0, width = 2560, height = 1440Monitor 1:  PPI = 144  Boundary: left = -1350, top = 0, width = 1350, height = 2160  If I set the scaling of second screen to 150% (same as Primary Screen), everything would be all right. What is going on? Can I only use LCL and Windows unit to solve this problem? ---------------------------------------------------------------------- rvk · 2024-12-05 13:12 Normally, an application is only DPI aware (for one monitor). So there is only one DPI known, not multiple per monitor. If you go into your project options, you can set the DPI awareness to "Per monitor" (True/PM). After that... the DPI settings are per monitor and you get the expected result. (BTW. You need to count idx from 0 to MonitorCount - 1. You counted from 1, not 0. But in your result it was correct monitor 0 so I guess that was a copy error.) QuoteMonitor 0:   PPI = 96   Boundary: left = 1920, top = 126, width = 1920, height = 1080 Monitor 1:   PPI = 144   Boundary: left = -1920, top = 129, width = 1920, height = 1080 Monitor 2:   PPI = 96   Boundary: left = 0, top = 0, width = 1920, height = 1200 ---------------------------------------------------------------------- Apiglio · 2024-12-05 14:13 Thank you, @rvk. It works. Quote from: rvk on December 05, 2024, 02:12:01 pm(BTW. You need to count idx from 0 to MonitorCount - 1. You counted from 1, not 0. But in your result it was correct monitor 0 so I guess that was a copy error.) Yes, that's awkward. I changed some code to make it brief.