Skip to content

Commit 53a93ce

Browse files
committed
TLabeledDbGrid: added color change for selected cells when the grid loses focus and dgAlwaysShowSelection option is active
1 parent 0fef961 commit 53a93ce

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Source/Vcl.LabeledDBCtrls.pas

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,26 @@ procedure TLabeledDbGrid.DrawColumnCell(const Rect: TRect; DataCol: Integer;
17861786
CellColor := GetCellColor;
17871787
end;
17881788

1789+
if dgAlwaysShowSelection in Options then
1790+
begin
1791+
if (DataSource = nil) or (DataSource.DataSet = nil) or (DataSource.DataSet.EOF and DataSource.DataSet.BOF) then
1792+
Canvas.Brush.Color := GetStyledColor(Color)
1793+
else
1794+
if not Focused and ( gdSelected in State ) then
1795+
begin
1796+
if DefaultWindowsStyleEnabled then
1797+
begin
1798+
Canvas.Brush.Color := clInactiveCaption;
1799+
Canvas.Font.Color := clInactiveCaptionText;
1800+
end
1801+
else
1802+
begin
1803+
Canvas.Brush.Color := LightenColor(GetStyledColor(clHighlight), 150);
1804+
Canvas.Font.Color := LightenColor(GetStyledColor(clHighlightText), 25);
1805+
end;
1806+
end;
1807+
end;
1808+
17891809
// Se il tipo di dato è Boolean, mostra in alternativa alle diciture
17901810
// false e true, l'immagine check e uncheck
17911811
if (not (csLoading in ComponentState)) and isCheckBoxedColumn(Column) and FDrawCheckBoxImages then

0 commit comments

Comments
 (0)