Skip to content

Commit

Permalink
Fixed TSpTBXPageScroller to support High DPI.
Browse files Browse the repository at this point in the history
Added  vclimg and vclwinx dependencies to the package.
  • Loading branch information
SilverpointDev committed Dec 24, 2020
1 parent b86f89b commit edd538f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion Packages/RAD Studio/SpTBXLib.dpk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ requires
vcl,
tb2k_d12,
rtl,
vclx;
vclx,
vclimg,
vclwinx;

contains
SpTBXItem in '..\..\Source\SpTBXItem.pas',
Expand Down
2 changes: 2 additions & 0 deletions Packages/RAD Studio/SpTBXLib.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
<DCCReference Include="tb2k_d12.dcp"/>
<DCCReference Include="rtl.dcp"/>
<DCCReference Include="vclx.dcp"/>
<DCCReference Include="vclimg.dcp"/>
<DCCReference Include="vclwinx.dcp"/>
<DCCReference Include="..\..\Source\SpTBXItem.pas"/>
<DCCReference Include="..\..\Source\SpTBXControls.pas"/>
<DCCReference Include="..\..\Source\SpTBXTabs.pas"/>
Expand Down
12 changes: 6 additions & 6 deletions Source/SpTBXPageScroller.pas
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ TSpTBXPageScroller = class(TSpTBXCustomPageScroller)
end;

{ Painting helpers }
procedure SpTBXPaintPageScrollButton(ACanvas: TCanvas; const ARect: TRect; ButtonType: TSpTBXPageScrollerButtonType; Hot: Boolean);
procedure SpTBXPaintPageScrollButton(ACanvas: TCanvas; const ARect: TRect; ButtonType: TSpTBXPageScrollerButtonType; Hot: Boolean; DPI: Integer);

implementation

Expand Down Expand Up @@ -228,7 +228,7 @@ function GetMinControlWidth(Control: TControl): Integer;
end;

procedure SpTBXPaintPageScrollButton(ACanvas: TCanvas; const ARect: TRect;
ButtonType: TSpTBXPageScrollerButtonType; Hot: Boolean);
ButtonType: TSpTBXPageScrollerButtonType; Hot: Boolean; DPI: Integer);
var
R: TRect;
Flags: Integer;
Expand Down Expand Up @@ -257,12 +257,12 @@ procedure SpTBXPaintPageScrollButton(ACanvas: TCanvas; const ARect: TRect;
else
Details := SpTBXThemeServices.GetElementDetails(tbPushButtonNormal);

CurrentSkin.PaintThemedElementBackground(ACanvas, ARect, Details);
CurrentSkin.PaintThemedElementBackground(ACanvas, ARect, Details, DPI);
CurrentSkin.GetThemedElementTextColor(Details, C);
end;
sknSkin:
begin
SpDrawXPButton(ACanvas, R, True, False, Hot, False, False, False);
SpDrawXPButton(ACanvas, R, True, False, Hot, False, False, False, DPI);
if Hot then
C := CurrentSkin.GetTextColor(skncButton, sknsHotTrack)
else
Expand Down Expand Up @@ -563,14 +563,14 @@ procedure TSpTBXCustomPageScroller.DrawNCArea(const DrawToDC: Boolean;
BR := R;
if Orientation = tpsoVertical then BR.Bottom := BR.Top + ButtonSize
else BR.Right := BR.Left + ButtonSize;
SpTBXPaintPageScrollButton(ACanvas, BR, CBtns[Orientation, False], FScrollDirection < 0);
SpTBXPaintPageScrollButton(ACanvas, BR, CBtns[Orientation, False], FScrollDirection < 0, CurrentPPI);
end;
if tpsbNext in FVisibleButtons then
begin
BR := R;
if Orientation = tpsoVertical then BR.Top := BR.Bottom - ButtonSize
else BR.Left := BR.Right - ButtonSize;
SpTBXPaintPageScrollButton(ACanvas, BR, CBtns[Orientation, True], FScrollDirection > 0);
SpTBXPaintPageScrollButton(ACanvas, BR, CBtns[Orientation, True], FScrollDirection > 0, CurrentPPI);
end;
ACanvas.Brush.Color := clBlue;
ACanvas.Pen.Color := clBlue;
Expand Down

0 comments on commit edd538f

Please sign in to comment.