Mega Code Archive

 
Categories / Delphi / Graphic
 

How to change the font color of the focussed cell in a Grid

Title: How to change the font color of the focussed cell in a Grid type TForm1 = class(TForm) {...} procedure StringGrid1GetEditMask(Sender: TObject; ACol, ARow: Integer; var Value: string); procedure DBGrid1ColEnter(Sender: TObject); end; {...} uses Mask; type TGridCracker = class(TCustomGrid); TEditorCracker = class(TCustomMaskEdit); procedure TForm1.StringGrid1GetEditMask(Sender: TObject; ACol, ARow: Integer; var Value: String); var editor: TEditorCracker; begin editor := TEditorCracker(TGridCracker(Sender).InplaceEditor); if Assigned(editor) then editor.Color := clYellow; end; procedure TForm1.DBGrid1ColEnter(Sender: TObject); var editor: TEditorCracker; begin editor := TGridCracker(TGridCracker(Sender).InplaceEditor); if Assigned(editor) then editor.Color := clGreen; end;