industrial: Fix LCL scaling for TMultislider

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7302 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-01-19 16:46:07 +00:00
parent 4062c3c12d
commit e975fefca2

View File

@ -22,12 +22,6 @@ interface
uses uses
Classes, SysUtils, Graphics, Controls, Types; Classes, SysUtils, Graphics, Controls, Types;
const
DEFAULT_SIZE = 28;
DEFAULT_TRACK_THICKNESS = 7;
DEFAULT_MULTISLIDER_WIDTH = 250;
DEFAULT_MULTISLIDER_HEIGHT = DEFAULT_SIZE * 5 div 4;
Type Type
{ TMultiSlider } { TMultiSlider }
@ -43,6 +37,12 @@ Type
Sender: TObject; AKind: TThumbKind; AValue: Integer) of object; Sender: TObject; AKind: TThumbKind; AValue: Integer) of object;
TMultiSlider = class(TCustomControl) TMultiSlider = class(TCustomControl)
private
const
DEFAULT_SIZE = 28;
DEFAULT_TRACK_THICKNESS = 7;
DEFAULT_MULTISLIDER_WIDTH = 250;
DEFAULT_MULTISLIDER_HEIGHT = DEFAULT_SIZE * 5 div 4;
private private
FAutoRotate: Boolean; FAutoRotate: Boolean;
FTrackSize: TPoint; FTrackSize: TPoint;
@ -191,8 +191,8 @@ begin
FColorBelow := clInactiveCaption; FColorBelow := clInactiveCaption;
FColorBetween := clActiveCaption; FColorBetween := clActiveCaption;
FColorThumb := clBtnFace; FColorThumb := clBtnFace;
FDefaultSize := Scale96ToFont(DEFAULT_SIZE); FDefaultSize := DEFAULT_SIZE;
FTrackThickness := Scale96ToFont(DEFAULT_TRACK_THICKNESS); FTrackThickness := DEFAULT_TRACK_THICKNESS;
FTrackStart := FDefaultSize*9 div 16 + 2; FTrackStart := FDefaultSize*9 div 16 + 2;
SetVertical(false); SetVertical(false);
FRangeMin := 0; FRangeMin := 0;
@ -224,15 +224,14 @@ begin
inherited DoAutoAdjustLayout(AMode, AXProportion, AYProportion); inherited DoAutoAdjustLayout(AMode, AXProportion, AYProportion);
if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then if AMode in [lapAutoAdjustWithoutHorizontalScrolling, lapAutoAdjustForDPI] then
begin begin
DisableAutosizing; if FVertical then
try begin
if IsTrackThicknessStored then FTrackThickness := Round(FTrackThickness * AXProportion);
if FVertical then FDefaultSize := Round(FDefaultSize * AYProportion);
FTrackThickness := Round(FTrackThickness * AXProportion) end else
else begin
FTrackThickness := Round(FTrackThickness * AYProportion); FTrackThickness := Round(FTrackThickness * AYProportion);
finally FDefaultSize := Round(FDefaultSize * AXProportion);
EnableAutoSizing;
end; end;
end; end;
end; end;