From 950e85af8f1dd02051b8e37c30db7d5c22820a34 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 22 Apr 2019 14:16:01 +0000 Subject: [PATCH] Industrial: Make TAnalogSensor high-dpi aware. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6856 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/industrialstuff/source/sensors.pas | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/components/industrialstuff/source/sensors.pas b/components/industrialstuff/source/sensors.pas index a4fb4e27b..f9adca195 100644 --- a/components/industrialstuff/source/sensors.pas +++ b/components/industrialstuff/source/sensors.pas @@ -318,14 +318,15 @@ begin end; procedure TAnalogSensor.PaintAsNeedle; -var MiddleX: Integer; - Angle: Double; - X, Y, W, H: Integer; +var + MiddleX: Integer; + Angle: Double; + X, Y, W, H: Integer; begin - X := 20; - Y := 23; - W := ClientWidth - 2*20; //130; - H := ClientHeight - 2*23; //33; + X := Scale96ToFont(20); + Y := Scale96ToFont(23); + W := ClientWidth - 2*X; + H := ClientHeight - 2*Y; if (W < 1) or (H < 1) then Exit; with Canvas do @@ -365,13 +366,14 @@ begin end; procedure TAnalogSensor.PaintAsHorizontal; -var MiddleX: Integer; - X, Y, W, H: Integer; +var + MiddleX: Integer; + X, Y, W, H: Integer; begin - X := 20; - Y := 23; - W := ClientWidth - 2*20; //130; - H := ClientHeight - 2*23; //33; + X := Scale96ToFont(20); + Y := Scale96ToFont(23); + W := ClientWidth - 2*X; + H := ClientHeight - 2*Y; if (W < 1) or (H < 1) then Exit; with Canvas do @@ -406,13 +408,14 @@ begin end; procedure TAnalogSensor.PaintAsVertical; -var MiddleY: Integer; - X, Y, W, H: Integer; +var + MiddleY: Integer; + X, Y, W, H: Integer; begin - X := 20; - Y := 23; - W := ClientWidth - 2*20; //130; - H := ClientHeight - 2*23; //33; + X := Scale96ToFont(20); + Y := Scale96ToFont(23); + W := ClientWidth - 2*X; + H := ClientHeight - 2*Y; if (W < 1) or (H < 1) then Exit; with Canvas do