-
不但可以职责分离，还不影响效率，可以进教科书的代码：）

For I := 0 To FLineList.Count - 1 Do
Begin
TempLine := TReportLine(FLineList[I]);
For J := 0 To TempLine.FCells.Count - 1 Do
Begin
TempCell := TReportCell(TempLine.FCells[J]);
// 若该CELL的右边等于选中的CELL的右边，将该CELL和NEXTCELL加入到两个LIST中去
If TempCell.CellRect.Right = ThisCell.CellRect.Right Then
Begin
ThisCellsList.Add(TempCell);

If TempCell.CellLeft + 10 > RectBorder.Left Then
RectBorder.Left := TempCell.CellLeft + 10;

If J < TempLine.FCells.Count - 1 Then
Begin
TempNextCell := TReportCell(TempLine.FCells[J + 1]);
If TempNextCell.CellRect.Right - 10 < RectBorder.Right Then
RectBorder.Right := TempNextCell.CellRect.Right - 10;
End;
End;
End;
End;
// responsibilty split :  ThisCellsList
For I := 0 To FLineList.Count - 1 Do
Begin
TempLine := TReportLine(FLineList[I]);
For J := 0 To TempLine.FCells.Count - 1 Do
Begin
TempCell := TempLine.FCells[J];
If TempCell.CellRect.Right = ThisCell.CellRect.Right Then
ThisCellsList.Add(TempCell);
End;
End;
RectBorder.Left := Max(ThisCellsList.MaxCellLeft +
DRAGMARGIN,RectBorder.Left);
RectBorder.Right := Min(ThisCellsList.MinNextCellRight -
DRAGMARGIN,RectBorder.Right);
Clear !