LCL: Paint TreeView trianges better when ExpandSignSize=5. Issue #31757, patch from AlexeyT.

git-svn-id: trunk@54823 -
This commit is contained in:
juha 2017-05-07 20:17:11 +00:00
parent 7518ea353a
commit c9304d3a8f

View File

@ -4940,7 +4940,7 @@ var
); );
var var
HalfSize, ALeft, ATop, ARight, ABottom: integer; HalfSize, ALeft, ATop, ARight, ABottom: integer;
Points: PPoint; Points: array[0..2] of TPoint; // for triangle
Details: TThemedElementDetails; Details: TThemedElementDetails;
R: TRect; R: TRect;
PrevColor: TColor; PrevColor: TColor;
@ -4948,12 +4948,12 @@ var
cShiftHorzArrow = 2; //paint horz arrow N pixels upper than MidY cShiftHorzArrow = 2; //paint horz arrow N pixels upper than MidY
begin begin
HalfSize := RealExpandSignSize div 2; HalfSize := RealExpandSignSize div 2;
if not Odd(RealExpandSignSize) then //if not Odd(RealExpandSignSize) then
Dec(HalfSize); // Dec(HalfSize);
ALeft := MidX - HalfSize; ALeft := MidX - HalfSize;
ARight := MidX + HalfSize;
ATop := MidY - HalfSize; ATop := MidY - HalfSize;
ARight := ALeft + RealExpandSignSize; ABottom := MidY + HalfSize;
ABottom := ATop + RealExpandSignSize;
if Assigned(FOnCustomDrawArrow) then if Assigned(FOnCustomDrawArrow) then
begin begin
@ -4976,7 +4976,7 @@ var
tvestPlusMinus: tvestPlusMinus:
begin begin
// draw a plus or a minus sign // draw a plus or a minus sign
R := Rect(ALeft, ATop, ARight, ABottom); R := Rect(ALeft, ATop, ARight+1, ABottom+1); //+1 for centering of line in square
Rectangle(R); Rectangle(R);
MoveTo(R.Left + 2, MidY); MoveTo(R.Left + 2, MidY);
LineTo(R.Right - 2, MidY); LineTo(R.Right - 2, MidY);
@ -4990,8 +4990,7 @@ var
tvestArrowFill: tvestArrowFill:
begin begin
// draw an arrow. down for collapse and right for expand // draw an arrow. down for collapse and right for expand
R := Rect(ALeft, ATop, ARight, ABottom); R := Rect(ALeft, ATop, ARight+1, ABottom+1); //+1 for simmetry of arrow
GetMem(Points, SizeOf(TPoint) * 3);
if CollapseSign then if CollapseSign then
begin begin
// draw an arrow down // draw an arrow down
@ -5016,8 +5015,6 @@ var
begin begin
Brush.Color := PrevColor; Brush.Color := PrevColor;
end; end;
FreeMem(Points);
end; end;
end; end;
end; end;