日期:2014-05-17 浏览次数:20799 次
function DrawFullGrid(GridTableView: TcxCustomGridTableView;
ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo): Boolean;
var
i: Integer;
lMaxRow: Integer;
Rect1: TRect;
ABorder: TcxBorder;
begin
ACanvas.FillRect(AViewInfo.Bounds);
ACanvas.DrawText(AViewInfo.GridRecord.DisplayTexts[AViewInfo.Item.Index], AViewInfo.Bounds, cxAlignHCenter);
//计算最多画多少行
lMaxRow := AViewInfo.GridViewInfo.NoDataInfoTextAreaBounds.Bottom - AViewInfo.GridViewInfo.NoDataInfoTextAreaBounds.Top mod AViewInfo.Bounds.Bottom - AViewInfo.Bounds.Top + 2;
if AViewInfo.GridRecord.Index = GridTableView.ViewData.RecordCount - 1 then
begin
for i := GridTableView.ViewData.RecordCount + 1 to lMaxRow do
begin
//画表格
Rect1.Top := AViewInfo.Bounds.Top - 1 + (AViewInfo.Bounds.Bottom - AViewInfo.Bounds.Top) * (i - GridTableView.ViewData.RecordCount);
Rect1.Bottom := AViewInfo.Bounds.Bottom + (AViewInfo.Bounds.Bottom - AViewInfo.Bounds.Top) * (i - GridTableView.ViewData.RecordCount);
Rect1.Left := AViewInfo.Bounds.Left - 1;
Rect1.Right := AViewInfo.Bounds.Right + 1;
if AViewInfo.GridView.Styles.Content <> nil then
ACanvas.Brush.Color := AViewInfo.GridView.Styles.Content.Color
else
ACanvas.Brush.Color := clWhite;
if (i mod 2) = 0 then
if AViewInfo.GridView.Styles.ContentOdd <> nil then
ACanvas.Brush.Color := AViewInfo.GridView.Styles.ContentOdd.Color
else
if AViewInfo.GridView.Styles.ContentEven <> nil then
ACanvas.Brush.Color := AViewInfo.GridView.Styles.ContentEven.Color;
ACanvas.FillRect(Rect1);
ACanvas.Brush.Color := AViewInfo.BorderColor[ABorder];
ACanvas.FrameRect(Rect1);
AViewInfo.GridViewInfo.Painter.ExcludeFromBackground(Rect1);
end;
end;
Result := True;
end;