You've already forked lazarus-ccr
GridPrinter: Support fixed col numbering. Better support of grid column formatting.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8637 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -864,6 +864,12 @@ begin
|
||||
exit;
|
||||
|
||||
lGrid := TGridAccess(FGrid);
|
||||
if (ACol = 0) and (FFixedCols > 0) and (ARow >= FFixedRows) and (goFixedRowNumbering in lGrid.Options) then
|
||||
begin
|
||||
Result := IntToStr(ARow - FFixedRows + 1);
|
||||
exit;
|
||||
end;
|
||||
|
||||
if lGrid.Columns.Enabled and (ACol >= FFixedCols) and (ARow = 0) and (FFixedRows > 0) then
|
||||
begin
|
||||
col := lGrid.Columns[ACol - FFixedCols];
|
||||
@ -1086,7 +1092,9 @@ end;
|
||||
procedure TGridPrinter.PrepareCanvas(ACanvas: TCanvas; ACol, ARow: Integer);
|
||||
var
|
||||
lGrid: TGridAccess;
|
||||
col: TGridColumn;
|
||||
textStyle: TTextStyle;
|
||||
font: TFont;
|
||||
begin
|
||||
lGrid := TGridAccess(FGrid);
|
||||
|
||||
@ -1095,18 +1103,56 @@ begin
|
||||
if (ACol < FFixedCols) or (ARow < FFixedRows) then
|
||||
ACanvas.Brush.Color := GetBrushColor(IfThen(lGrid.FixedColor = clBtnFace, $E0E0E0, lGrid.FixedColor))
|
||||
else
|
||||
if lGrid.Columns.Enabled and (ACol >= FFixedCols) then
|
||||
begin
|
||||
col := lGrid.Columns[ACol - FFixedCols];
|
||||
ACanvas.Brush.Color := GetBrushColor(col.Color);
|
||||
end else
|
||||
begin
|
||||
if Odd(ARow) then
|
||||
ACanvas.Brush.Color := GetBrushColor(lGrid.Color)
|
||||
else
|
||||
ACanvas.Brush.Color := GetBrushColor(lGrid.AlternateColor);
|
||||
end;
|
||||
|
||||
// Font
|
||||
SelectFont(ACanvas, lGrid.Font, FPrintScaleFactor);
|
||||
ACanvas.Font.Color := GetFontColor(lGrid.Font.Color);
|
||||
if lGrid.Columns.Enabled and (ACol >= FFixedCols) then
|
||||
begin
|
||||
col := lGrid.Columns[ACol - FFixedCols];
|
||||
if (ARow < FFixedRows) then
|
||||
font := col.Title.Font
|
||||
else
|
||||
font := col.Font;
|
||||
SelectFont(ACanvas, font, FPrintScaleFactor);
|
||||
ACanvas.Font.Color := GetFontColor(font.Color);
|
||||
end else
|
||||
begin
|
||||
SelectFont(ACanvas, lGrid.Font, FPrintScaleFactor);
|
||||
ACanvas.Font.Color := GetFontColor(lGrid.Font.Color);
|
||||
end;
|
||||
FixFontSize(ACanvas.Font);
|
||||
|
||||
// Text style
|
||||
textStyle := DefaultTextStyle;
|
||||
if lGrid.Columns.Enabled and (ACol >= FFixedCols) then
|
||||
begin
|
||||
col := lGrid.Columns[ACol - FFixedCols];
|
||||
if (ARow < FFixedRows) then
|
||||
begin
|
||||
textStyle.Alignment := col.Title.Alignment;
|
||||
textStyle.Layout := col.Title.Layout;
|
||||
if col.Title.MultiLine then
|
||||
begin
|
||||
textStyle.Wordbreak := true;
|
||||
textStyle.SingleLine := false;
|
||||
textStyle.EndEllipsis := false;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
textStyle.Alignment := col.Alignment;
|
||||
textStyle.Layout := col.Layout;
|
||||
end;
|
||||
end;
|
||||
if (goCellEllipsis in lGrid.Options) then
|
||||
textStyle.EndEllipsis := true;
|
||||
ACanvas.TextStyle := textStyle;
|
||||
|
Reference in New Issue
Block a user