[Solved] Saving Window position and High DPI lazarus / 31-LCL ---------------------------------------------------------------------- lainz · 2018-05-02 17:29 Hi, I'm with this problem, I can't solve. I store the properties of the Form with JSONPropStorage. I store left, top, width and height. I'm using Lazarus trunk, and I set Use LCL Scaling (hi-dpi) to true in the options. The problem is that every time I open the window, it gets bigger. As I understand the problem, it loads the stored values and then scales it. The next time does the same, loads the stored values and scales them. How I can prevent this to happen? I've set the properties to store (left, top, width, height) with the object inspector (SessionProperties). I don't know how I can solve it. The DPI can be changed also, I'm running now at 120%, but when I switch to another mode for any reason, It will stop working as well. ---------------------------------------------------------------------- balazsszekely · 2018-05-02 17:52 Did you try to scale with MulDiv from LCLType? 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 WidthX% := MulDiv(Width100%, Screen.PixelsPerInch, 96);Where Width100% is the default value at 96 DPI. So one possible solution is to always store the width in 96 DPI equivalent, then scale it whenever is needed. ---------------------------------------------------------------------- lainz · 2018-05-02 18:18 Thanks. Yes, I need to change the automatic saving and try with your code. The problem of the automatic saving / loading, is that I can't change nothing. ---------------------------------------------------------------------- balazsszekely · 2018-05-02 18:27 Plese try something like this: 1. Save Width96 := MulDiv(CurWidth, 96,  Screen.PixelsPerInch); Save Width96 to json. 2. Load Load Width96 from JSON: CurWidth  := MulDiv(Width96,  Screen.PixelsPerInch, 96); ---------------------------------------------------------------------- lainz · 2018-05-02 19:42 Thanks GetMem, it works. 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 procedure TfrmTimeEntry.JSONPropStorage1RestoreProperties(Sender: TObject);begin  Width := MulDiv(Width, 96, Screen.PixelsPerInch);  Height := MulDiv(Height, 96, Screen.PixelsPerInch);    end; It's only needed on restore.