// Wenn man ein
Stringgrid mittels DrawCell einfärbt, wird bei Eingabe von
// Zeichen die entsprechende Zelle in clWindow
(meist weiss)
angezeigt.
// Um das zu umgehen, muss man den InplaceEditor ändern:
// Getestet mit D4 unter XP
var
FontColor: TColor = clYellow;
BrushColor: TColor = clNavy;
type
TStringGridX = class(TStringGrid)
public
property InplaceEditor;
end;
TInplaceEditX = class(TInplaceEdit)
public
property Color;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
with TStringGrid(Sender) do begin
if (ARow >= FixedRows) and (ACol >= FixedCols) then
with Canvas do begin
brush.color := BrushColor;
fillrect(Rect);
font.color := FontColor;
TextRect(Rect, Rect.left + 2, Rect.top + 2, cells[ACol, ARow]);
end;
end;
end;
procedure TForm1.StringGrid1GetEditText(Sender: TObject; ACol,
ARow: Integer; var Value: string);
begin
TInplaceEditX(TStringGridX(Sender).InplaceEditor).Color := BrushColor;
Font.Color := FontColor;
end;

|