cxgridrows.pas
来自「胜天进销存源码,国产优秀的进销存」· PAS 代码 · 共 1,895 行 · 第 1/5 页
PAS
1,895 行
function TcxGridDataCellPainter.GetViewInfo: TcxGridDataCellViewInfo;
begin
Result := TcxGridDataCellViewInfo(inherited ViewInfo);
end;
procedure TcxGridDataCellPainter.DrawBorder(ABorder: TcxBorder);
begin
if ExcludeFromClipRect then
inherited
else
TcxGridTablePainter(ViewInfo.GridViewInfo.Painter).AddGridLine(ViewInfo.BorderBounds[ABorder]);
end;
function TcxGridDataCellPainter.ExcludeFromClipRect: Boolean;
begin
Result := ViewInfo.RecordViewInfo.CellsAreaViewInfo.Visible;
end;
{ TcxGridDataRowPainter }
function TcxGridDataRowPainter.GetViewInfo: TcxGridDataRowViewInfo;
begin
Result := TcxGridDataRowViewInfo(inherited ViewInfo);
end;
procedure TcxGridDataRowPainter.DrawCells;
begin
ViewInfo.RecordsViewInfo.PainterClass.DrawDataRowCells(ViewInfo);
with ViewInfo do
if HasPreview and (PreviewViewInfo.Height <> 0) then
PreviewViewInfo.Paint;
end;
function TcxGridDataRowPainter.GetShowCells: Boolean;
begin
Result := True;
end;
procedure TcxGridDataRowPainter.Paint;
var
AClipRegion: TcxRegion;
begin
if ShowCells then
begin
AClipRegion := Canvas.GetClipRegion;
try
DrawCells;
finally
Canvas.SetClipRegion(AClipRegion, roSet);
end;
end;
inherited;
end;
{ TcxGridNewItemRowPainter }
function TcxGridNewItemRowPainter.GetViewInfo: TcxGridNewItemRowViewInfo;
begin
Result := TcxGridNewItemRowViewInfo(inherited ViewInfo);
end;
procedure TcxGridNewItemRowPainter.DrawBackground;
begin
if not ShowCells and not ViewInfo.Transparent then
DrawBackground(ViewInfo.ContentBounds)
else
inherited;
end;
procedure TcxGridNewItemRowPainter.DrawSeparator;
begin
ViewInfo.LookAndFeelPainter.DrawHeader(Canvas, ViewInfo.SeparatorBounds,
ViewInfo.SeparatorBounds, [], cxBordersAll, cxbsNormal, taLeftJustify, vaTop,
False, False, '', nil, ViewInfo.LookAndFeelPainter.DefaultHeaderTextColor,
ViewInfo.SeparatorColor);
end;
function TcxGridNewItemRowPainter.GetShowCells: Boolean;
begin
Result := ViewInfo.Text = '';
end;
procedure TcxGridNewItemRowPainter.Paint;
begin
inherited;
DrawText;
end;
{$IFDEF USETABCONTROL}
{ TcxGridMasterDataRowDetailsSiteTabsPainter }
function TcxGridMasterDataRowDetailsSiteTabsPainter.GetViewInfo: TcxGridMasterDataRowDetailsSiteLeftTabsViewInfo;
begin
Result := TcxGridMasterDataRowDetailsSiteLeftTabsViewInfo(inherited ViewInfo);
end;
procedure TcxGridMasterDataRowDetailsSiteTabsPainter.DrawBottomGridLine;
begin
Canvas.Brush.Color := ViewInfo.BottomGridLineColor;
Canvas.FillRect(ViewInfo.BottomGridLineBounds);
end;
procedure TcxGridMasterDataRowDetailsSiteTabsPainter.Paint;
begin
inherited;
if ViewInfo.HasBottomGridLine then DrawBottomGridLine;
end;
{$ENDIF}
{ TcxGridExpandButtonCellPainter }
function TcxGridExpandButtonCellPainter.GetViewInfo: TcxGridExpandButtonCellViewInfo;
begin
Result := TcxGridExpandButtonCellViewInfo(inherited ViewInfo);
end;
procedure TcxGridExpandButtonCellPainter.DrawBorder(ABorder: TcxBorder);
begin
inherited;
if (ABorder = bRight) and not ViewInfo.Transparent then
DrawBackground(ViewInfo.RightBorderRestSpaceBounds);
end;
{ TcxGridMasterDataRowPainter }
function TcxGridMasterDataRowPainter.GetViewInfo: TcxGridMasterDataRowViewInfo;
begin
Result := TcxGridMasterDataRowViewInfo(inherited ViewInfo);
end;
procedure TcxGridMasterDataRowPainter.DrawCells;
begin
inherited;
DrawExpandButtonCell;
end;
procedure TcxGridMasterDataRowPainter.DrawDetailsSite;
begin
ViewInfo.DetailsSiteViewInfo.Paint(Canvas);
ViewInfo.GridViewInfo.Painter.ExcludeFromBackground(ViewInfo.DetailsSiteViewInfo.Bounds);
end;
{procedure TcxGridMasterDataRowPainter.DrawDetailsArea;
begin
ViewInfo.DetailsAreaViewInfo.Paint;
end;}
procedure TcxGridMasterDataRowPainter.DrawExpandButtonCell;
var
AClipRegion: TcxRegion;
begin
AClipRegion := Canvas.GetClipRegion;
try
Canvas.ExcludeClipRect(ViewInfo.CellsAreaBounds);
ViewInfo.ExpandButtonCellViewInfo.Paint;
finally
Canvas.SetClipRegion(AClipRegion, roSet);
end;
end;
function TcxGridMasterDataRowPainter.NeedsPainting: Boolean;
begin
Result := inherited NeedsPainting or
ViewInfo.DetailsSiteVisible and Canvas.RectVisible(ViewInfo.DetailsAreaViewInfo.GetAreaBoundsForPainting);
end;
procedure TcxGridMasterDataRowPainter.Paint;
begin
if ViewInfo.DetailsSiteVisible then
begin
DrawDetailsSite;
//DrawDetailsArea;
end;
inherited;
end;
{ TcxGridGroupCellPainter }
function TcxGridGroupCellPainter.GetViewInfo: TcxGridGroupCellViewInfo;
begin
Result := TcxGridGroupCellViewInfo(inherited ViewInfo);
end;
procedure TcxGridGroupCellPainter.DrawBorder(ABorder: TcxBorder);
begin
inherited;
with Canvas, ViewInfo do
if (ABorder = bBottom) and GridRecord.Expanded then
if GridViewInfo.LevelIndentBackgroundBitmap = nil then
begin
Brush.Color := GridViewInfo.LevelIndentColors[GridRecord.Level];
FillRect(ExpandedAreaBounds);
end
else
FillRect(ExpandedAreaBounds, GridViewInfo.LevelIndentBackgroundBitmap);
end;
{ TcxGridGroupSummaryCellPainter }
function TcxGridGroupSummaryCellPainter.GetViewInfo: TcxGridGroupSummaryCellViewInfo;
begin
Result := TcxGridGroupSummaryCellViewInfo(inherited ViewInfo);
end;
procedure TcxGridGroupSummaryCellPainter.Paint;
begin
inherited;
ViewInfo.SeparatorViewInfo.Paint(Canvas);
end;
{ TcxGridGroupRowPainter }
function TcxGridGroupRowPainter.GetViewInfo: TcxGridGroupRowViewInfo;
begin
Result := TcxGridGroupRowViewInfo(inherited ViewInfo);
end;
procedure TcxGridGroupRowPainter.DrawBackground;
begin
end;
procedure TcxGridGroupRowPainter.DrawSeparator;
var
R: TRect;
begin
R := ViewInfo.SeparatorIndentBounds;
if not IsRectEmpty(R) then
DrawIndentPart(ViewInfo.Level, R);
inherited;
end;
procedure TcxGridGroupRowPainter.DrawSummaryCells;
var
I: Integer;
begin
if ViewInfo.SummaryBeginningSpacerViewInfo <> nil then
ViewInfo.SummaryBeginningSpacerViewInfo.Paint(Canvas);
for I := 0 to ViewInfo.SummaryCellViewInfoCount - 1 do
ViewInfo.SummaryCellViewInfos[I].Paint(Canvas);
if ViewInfo.SummaryEndingSpacerViewInfo <> nil then
ViewInfo.SummaryEndingSpacerViewInfo.Paint(Canvas);
end;
procedure TcxGridGroupRowPainter.Paint;
begin
ViewInfo.CellViewInfo.Paint;
DrawSummaryCells;
inherited;
end;
{ TcxGridCellViewInfo }
function TcxGridCellViewInfo.GetGridView: TcxGridTableView;
begin
Result := TcxGridTableView(inherited GridView);
end;
function TcxGridCellViewInfo.GetGridLines: TcxGridLines;
begin
Result := RecordViewInfo.GridLines;
end;
function TcxGridCellViewInfo.GetGridRecord: TcxCustomGridRow;
begin
Result := TcxCustomGridRow(inherited GridRecord);
end;
function TcxGridCellViewInfo.GetGridViewInfo: TcxGridTableViewInfo;
begin
Result := TcxGridTableViewInfo(inherited GridViewInfo);
end;
function TcxGridCellViewInfo.GetRecordViewInfo: TcxCustomGridRowViewInfo;
begin
Result := TcxCustomGridRowViewInfo(inherited RecordViewInfo);
end;
function TcxGridCellViewInfo.GetBorderColor(AIndex: TcxBorder): TColor;
begin
Result := GridViewInfo.GridLineColor;
end;
function TcxGridCellViewInfo.GetBorderWidth(AIndex: TcxBorder): Integer;
begin
Result := GridViewInfo.GridLineWidth;
end;
procedure TcxGridCellViewInfo.GetViewParams(var AParams: TcxViewParams);
begin
GridView.Styles.GetDataCellParams(GridRecord, nil, AParams, True, Self);
end;
{ TcxGridDataCellViewInfo }
destructor TcxGridDataCellViewInfo.Destroy;
var
I: Integer;
begin
if FIsMerging then
begin
for I := 0 to MergedCellCount - 1 do
MergedCells[I].FMergingCell := nil;
FMergedCells.Free;
end
else
if FIsMerged and (FMergingCell <> nil) then
FMergingCell.RemoveMergedCell(Self);
inherited;
end;
function TcxGridDataCellViewInfo.GetCacheItem: TcxGridTableViewInfoCacheItem;
begin
Result := TcxGridTableViewInfoCacheItem(inherited CacheItem);
end;
function TcxGridDataCellViewInfo.GetGridView: TcxGridTableView;
begin
Result := TcxGridTableView(inherited GridView);
end;
function TcxGridDataCellViewInfo.GetGridViewInfo: TcxGridTableViewInfo;
begin
Result := TcxGridTableViewInfo(inherited GridViewInfo);
end;
function TcxGridDataCellViewInfo.GetItem: TcxGridColumn;
begin
Result := TcxGridColumn(inherited Item);
end;
function TcxGridDataCellViewInfo.GetMergedCell(Index: Integer): TcxGridDataCellViewInfo;
begin
Result := TcxGridDataCellViewInfo(FMergedCells[Index]);
end;
function TcxGridDataCellViewInfo.GetMergedCellCount: Integer;
begin
Result := FMergedCells.Count;
end;
function TcxGridDataCellViewInfo.GetMergedCellOfFocusedRow: TcxGridDataCellViewInfo;
var
I: Integer;
begin
for I := 0 to MergedCellCount - 1 do
begin
Result := MergedCells[I];
if Result.RecordViewInfo.Focused then Exit;
end;
Result := nil;
end;
function TcxGridDataCellViewInfo.GetRecordViewInfo: TcxGridDataRowViewInfo;
begin
Result := TcxGridDataRowViewInfo(inherited RecordViewInfo);
end;
procedure TcxGridDataCellViewInfo.AfterRowsViewInfoCalculate;
var
AProperties: TcxCustomEditProperties;
AValue: TcxEditValue;
I: Integer;
ARowViewInfo: TcxCustomGridRowViewInfo;
ACellViewInfo: TcxGridDataCellViewInfo;
procedure UpdateBounds;
begin
if FIsMerging then
begin
Bounds.Bottom := MergedCells[MergedCellCount - 1].Bounds.Bottom;
Recalculate;
end
else
if Height <> FOriginalHeight then
begin
Bounds.Bottom := Bounds.Top + FOriginalHeight;
Recalculate;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?