mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 18:58:17 +02:00
LCL, fix dbgrid cells color when DefaultDrawing=false
git-svn-id: trunk@46408 -
This commit is contained in:
parent
e460c806cb
commit
47e3161749
@ -390,6 +390,7 @@ type
|
||||
procedure DrawFocusRect(aCol,aRow:Integer; ARect:TRect); override;
|
||||
procedure DrawRow(ARow: Integer); override;
|
||||
procedure DrawCell(aCol,aRow: Integer; aRect: TRect; aState:TGridDrawState); override;
|
||||
procedure DrawCellBackground(aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
|
||||
procedure DrawCheckboxBitmaps(aCol: Integer; aRect: TRect; F: TField);
|
||||
procedure DrawFixedText(aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);
|
||||
procedure DrawColumnText(aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState); override;
|
||||
@ -926,7 +927,8 @@ begin
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TCustomDBGrid.OnDataSetScrolled(aDataset: TDataSet; Distance: Integer);
|
||||
procedure TCustomDBGrid.OnDataSetScrolled(aDataSet: TDataSet; Distance: Integer
|
||||
);
|
||||
var
|
||||
OldEditorMode: boolean;
|
||||
begin
|
||||
@ -1977,11 +1979,7 @@ var
|
||||
cbs: TColumnButtonStyle;
|
||||
begin
|
||||
|
||||
// background
|
||||
if (gdFixed in aState) and (TitleStyle=tsNative) then
|
||||
DrawThemedCell(aCol, aRow, aRect, aState)
|
||||
else
|
||||
Canvas.FillRect(aRect);
|
||||
DrawCellBackground(aCol, aRow, aRect, aState);
|
||||
|
||||
if gdFixed in aState then
|
||||
DrawFixedText(aCol, aRow, aRect, aState)
|
||||
@ -2044,11 +2042,24 @@ procedure TCustomDBGrid.DoPrepareCanvas(aCol, aRow: Integer;
|
||||
aState: TGridDrawState);
|
||||
var
|
||||
DataCol: Integer;
|
||||
IsSelected: boolean;
|
||||
begin
|
||||
if Assigned(OnPrepareCanvas) and (ARow>=FixedRows) then begin
|
||||
DataCol := ColumnIndexFromGridColumn(aCol);
|
||||
if DataCol>=0 then
|
||||
OnPrepareCanvas(Self, DataCol, TColumn(Columns[DataCol]), aState);
|
||||
if (ARow>=FixedRows) then begin
|
||||
|
||||
if not DefaultDrawing then begin
|
||||
GetSelectedState(aState, IsSelected);
|
||||
if IsSelected then begin
|
||||
Canvas.Brush.Color := SelectedColor;
|
||||
Canvas.Font.Color := clHighlightText;
|
||||
end;
|
||||
end;
|
||||
|
||||
if Assigned(OnPrepareCanvas) then begin
|
||||
DataCol := ColumnIndexFromGridColumn(aCol);
|
||||
if DataCol>=0 then
|
||||
OnPrepareCanvas(Self, DataCol, TColumn(Columns[DataCol]), aState);
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2935,7 +2946,10 @@ begin
|
||||
{$endif dbgGridPaint}
|
||||
|
||||
if (gdFixed in aState) or DefaultDrawing then
|
||||
DefaultDrawCell(aCol, aRow, aRect, aState);
|
||||
DefaultDrawCell(aCol, aRow, aRect, aState)
|
||||
else
|
||||
if not DefaultDrawing then
|
||||
DrawCellBackground(aCol, aRow, aRect, aState);
|
||||
|
||||
if (ARow>=FixedRows) and Assigned(OnDrawColumnCell) and
|
||||
not (csDesigning in ComponentState) then begin
|
||||
@ -2949,6 +2963,16 @@ begin
|
||||
DrawCellGrid(aCol, aRow, aRect, aState);
|
||||
end;
|
||||
|
||||
procedure TCustomDBGrid.DrawCellBackground(aCol, aRow: Integer; aRect: TRect;
|
||||
aState: TGridDrawState);
|
||||
begin
|
||||
// background
|
||||
if (gdFixed in aState) and (TitleStyle=tsNative) then
|
||||
DrawThemedCell(aCol, aRow, aRect, aState)
|
||||
else
|
||||
Canvas.FillRect(aRect);
|
||||
end;
|
||||
|
||||
procedure TCustomDBGrid.DrawCheckboxBitmaps(aCol: Integer; aRect: TRect;
|
||||
F: TField);
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user