- This topic has 2 replies, 2 voices, and was last updated 5 years, 9 months ago by kaju_74.
-
AuthorPosts
-
February 8, 2019 at 8:56 am #38144kaju_74Participant
Hi,
I'm playing with the CustomPPI settings in my app and have a problem if I try to save & restore used windows dimensions & fonts. After the form has been shown, I persist the actual setted font (for an embedded editor) as well as the properties “Height” & “Width” of the form. If this form is loaded the next time, I'll read the previously written settings and initialize the corresponding properties (Font.Size, Height & Width).
This works fine with the default scaling (ppi). As soon as I use a custom ppi, all settings will be saved with larger values than they realy are – e.g. my form will be widther & heigher each time and the font is scalled up every time.
I've logged the width value before & after showing the form and due of the AlphaSkin scaling, the width property is (for example) 100pixels larger than before. It seems, AlphaSkin increases this kind of properties for the scaling process but didn't restore them before the form is closing.
Is there any way to retrieve the 'real' values which could be saved for further calls to this form?
Regards,
kaju
February 8, 2019 at 3:16 pm #59037SupportKeymasterHello
Look, maybe this code can help you to save original size:
Code:uses sSkinManager, sVclUtils;
…
var
iPPI: integer;
…
if DefaultManager.IsActive then begin
if DefaultManager.Options.ScaleMode = smVCL then
iPPI := DefaultPPI
else
iPPI := DefaultManager.Options.PixelsPerInch
end
else
iPPI := 96;SaveMainFormWidthHeight(Width * 96 div iPPI, Height * 96 div iPPI);
February 11, 2019 at 3:52 pm #59057kaju_74Participant'Support' wrote:Hello
Look, maybe this code can help you to save original size:
Code:uses sSkinManager, sVclUtils;
…
var
iPPI: integer;
…
if DefaultManager.IsActive then begin
if DefaultManager.Options.ScaleMode = smVCL then
iPPI := DefaultPPI
else
iPPI := DefaultManager.Options.PixelsPerInch
end
else
iPPI := 96;SaveMainFormWidthHeight(Width * 96 div iPPI, Height * 96 div iPPI);
Hi,
I've figured out nearly the same by playing with it, but: You'll get rounding errors where the form dimension will be shrink by 0-1 pixel each time – so that's not the full solution for me right now…but I've another idea if there's no native support to fix it.
Thank you very much,
kaju
-
AuthorPosts
- You must be logged in to reply to this topic.