...
NodeRow,NodeLevel,CurrentLevel: integer;
...
if (FNumNodes > 0) and (ACol = 0) and (ARow >= FixedRows) and (FCellNode.ShowTree) then
begin
Canvas.Pen.Color := FCellNode.TreeColor;
Canvas.Pen.Width := 1;
lvl := CellProperties[0,ARow].NodeLevel;
ARect.Left := NodeIndent(ARow);
ci := ARect.Left - CellNode.NodeIndent + 2 + CellNode.NodeIndent div 2;
if (lvl > 0) then
begin
// horizontal node line
Canvas.MoveTo(ci,ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
if FCellNode.ShowTreeFull then
Canvas.LineTo(ARect.Right,ARect.Top + (ARect.Bottom - ARect.Top) shr 1)
else
Canvas.LineTo(ARect.Left + 4,ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
end;
case GetNodeSpanType(ARow) of
1:begin
Canvas.MoveTo(ci,ARect.Top);
Canvas.LineTo(ci,ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
end;
2:begin
Canvas.MoveTo(ci, ARect.Top );
Canvas.LineTo(ci, ARect.Bottom + 4);
end;
end;
if HasCellProperties(0,ARow) then
begin
CurrentLevel := CellProperties[0,ARow].NodeLevel;
NodeRow := ARow;
while (CurrentLevel>1) do
begin
NodeLevel := CurrentLevel + 1;
while (NodeLevel>CurrentLevel) do
begin
NodeRow := NodeRow + 1;
if (NodeRow=RowCount) then NodeLevel := 0
else
if (CellTypes[ACol,NodeRow]=ctNode) then NodeLevel := CellProperties[0,NodeRow].NodeLevel;
end;
while (NodeLevel<CurrentLevel) do
begin
CurrentLevel := CurrentLevel - 1;
if (CurrentLevel = (CellProperties[0,ARow].NodeLevel - 1)) then
if (CellTypes[ACol,ARow] = ctNode) then
begin
Canvas.MoveTo(ci - CellNode.NodeIndent * (CellProperties[0,ARow].NodeLevel - CurrentLevel), ARect.Top );
Canvas.LineTo(ci - CellNode.NodeIndent * (CellProperties[0,ARow].NodeLevel - CurrentLevel), ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
Canvas.LineTo(ci - CellNode.NodeIndent * (CellProperties[0,ARow].NodeLevel - CurrentLevel) + CellNode.NodeIndent, ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
end;
end;
if(CurrentLevel>1) then
CurrentLevel := CurrentLevel - 1;
begin
Canvas.MoveTo(ci - CellNode.NodeIndent * (CellProperties[0,ARow].NodeLevel - CurrentLevel), ARect.Top );
Canvas.LineTo(ci - CellNode.NodeIndent * (CellProperties[0,ARow].NodeLevel - CurrentLevel), ARect.Bottom + 4);
end;
end;
{// draw straight interconnecting lines
for vpos := 1 to CellProperties[0,ARow].NodeLevel do
begin
// draw line till middle of cell
Canvas.MoveTo(ci - CellNode.NodeIndent * vpos, ARect.Top );
Canvas.LineTo(ci - CellNode.NodeIndent * vpos, ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
if (ARow < RowCount - 1) then
begin
if (CellProperties[0,ARow + 1].NodeLevel = 0) then
begin
if (vpos < CellProperties[0,ARow].NodeLevel) then
Canvas.LineTo(ci - CellNode.NodeIndent * vpos + CellNode.NodeIndent, ARect.Top + (ARect.Bottom - ARect.Top) shr 1)
end
else
// draw till bottom
Canvas.LineTo(ci - CellNode.NodeIndent * vpos, ARect.Bottom + 4);
end
else
begin
if (vpos < CellProperties[0,ARow].NodeLevel) then
Canvas.LineTo(ci - CellNode.NodeIndent * vpos + CellNode.NodeIndent, ARect.Top + (ARect.Bottom - ARect.Top) shr 1);
//Canvas.LineTo(ci - CellNode.NodeIndent * vpos, ARect.Bottom + 4);
end;
end;}
end;
Canvas.Pen.Style := psSolid;
end;
...