Skip to content

Commit a6d581c

Browse files
committed
* Fix computenodeheight when drawing horizontal line / remove redundant check
1 parent 24a1391 commit a6d581c

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

Source/VirtualTrees.pas

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7406,30 +7406,27 @@ procedure TVirtualTreeColumns.AdjustAutoSize(CurrentIndex: TColumnIndex; Force:
74067406
if (AutoIndex < 0) or (AutoIndex >= Count) then
74077407
AutoIndex := Count - 1;
74087408

7409-
if AutoIndex >= 0 then
7409+
with FHeader.Treeview do
74107410
begin
7411-
with FHeader.Treeview do
7412-
begin
7413-
if HandleAllocated then
7414-
RestWidth := ClientWidth
7415-
else
7416-
RestWidth := Width;
7417-
end;
7411+
if HandleAllocated then
7412+
RestWidth := ClientWidth
7413+
else
7414+
RestWidth := Width;
7415+
end;
74187416

7419-
// Go through all columns and calculate the rest space remaining.
7420-
for Index := 0 to Count - 1 do
7421-
if (Index <> AutoIndex) and (coVisible in Items[Index].FOptions) then
7422-
Dec(RestWidth, Items[Index].Width);
7417+
// Go through all columns and calculate the rest space remaining.
7418+
for Index := 0 to Count - 1 do
7419+
if (Index <> AutoIndex) and (coVisible in Items[Index].FOptions) then
7420+
Dec(RestWidth, Items[Index].Width);
74237421

7424-
with Items[AutoIndex] do
7422+
with Items[AutoIndex] do
7423+
begin
7424+
NewValue := Max(MinWidth, Min(MaxWidth, RestWidth));
7425+
if Force or (FWidth <> NewValue) then
74257426
begin
7426-
NewValue := Max(MinWidth, Min(MaxWidth, RestWidth));
7427-
if Force or (FWidth <> NewValue) then
7428-
begin
7429-
FWidth := NewValue;
7430-
UpdatePositions;
7431-
FHeader.Treeview.DoColumnResize(AutoIndex);
7432-
end;
7427+
FWidth := NewValue;
7428+
UpdatePositions;
7429+
FHeader.Treeview.DoColumnResize(AutoIndex);
74337430
end;
74347431
end;
74357432
end;
@@ -31714,6 +31711,8 @@ function TCustomVirtualStringTree.ComputeNodeHeight(Canvas: TCanvas; Node: PVirt
3171431711
DrawFormat := DrawFormat or DT_LEFT;
3171531712
DrawText(Canvas.Handle, PChar(S), Length(S), PaintInfo.CellRect, DrawFormat);
3171631713
Result := PaintInfo.CellRect.Bottom - PaintInfo.CellRect.Top;
31714+
if toShowHorzGridLines in TreeOptions.PaintOptions then
31715+
Inc(Result);
3171731716
end;
3171831717

3171931718
//----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)