5,928
社区成员




procedure TForm1.AdvStringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
s: string;
begin
s := AdvStringGrid1.Cells[ACol, ARow];
if ARow mod 2 = 0 then
begin
AdvStringGrid1.Canvas.Font.Color := clBlack;
AdvStringGrid1.Canvas.Brush.Color := $00FFCACA;
AdvStringGrid1.Canvas.FillRect(Rect);
AdvStringGrid1.Canvas.TextOut(Rect.Left, Rect.top, s);
end;
if gdFocused in State then
begin
AdvStringGrid1.Canvas.Brush.Color := clYellow;
AdvStringGrid1.Canvas.FillRect(Rect);
AdvStringGrid1.Canvas.Pen.Width := 3;
AdvStringGrid1.Canvas.Pen.Color := clBlue;
AdvStringGrid1.Canvas.Pen.Style := psInsideFrame;
AdvStringGrid1.Canvas.Rectangle(AdvStringGrid1.CellRect(ACol, ARow));
AdvStringGrid1.Canvas.TextOut(Rect.Left + 5, Rect.top +3, s);
AdvStringGrid1.Canvas.Brush.Color := clBlue;
AdvStringGrid1.Canvas.DrawFocusRect(AdvStringGrid1.CellRect(ACol, ARow));
end;
end;