Registriert seit: 24. Apr 2004
755 Beiträge
Delphi 2010 Professional
|
Re: Die Zelle werd zwar Blau aber der Text nicht Weiss
20. Mär 2005, 11:36
versuche es mal so:
Delphi-Quellcode:
procedure TForm1.GridServersDrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var
bgColor: TColor;
fontColor: TColor;
begin
with (Sender as TStringGrid) do
begin
if gdFixed in State then
begin
bgColor := FixedColor
fontColor := clBlack;
end else if IsWaiting in State then
begin
bgColor := Color;
fontColor := clBlack;
end else if gdFocused in State then
begin
bgColor := clActiveCaption;
fontColor := clWhite;
end else if gdSelected in State then
begin
bgColor := clLime;
fontColor := clWhite;
end else
begin
bgColor := Color;
fontColor := clBlack;
end;
with Canvas do
begin
Brush.Color := bgColor;
Font.Color := fontColor;
FillRect(Rect);
if not IsWaiting and (gdFocused in State) then
begin
Draw(Rect.Left, Rect.Top, Image1.Picture.Graphic);
Rect.Left := Rect.Left + Image1.Width +2;
end;
TextOut(Rect.Right - TextWidth(Cells[ACol, ARow]) - 2,
Rect.Top + 2, Cells[ACol, ARow]);
end;
end;
end;
|
|
Zitat
|