在dbgrid的DrawColumnCell事件里
比如选中后的是红底黄字;
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
C1, C2: TColor;
begin
if gdSelected in State then
begin
with TDBGrid(Sender).Canvas do
begin
C1 := Brush.Color;
C2 := Font.Color; Brush.Color := ClRed;//红底
Font.Color := Clyellow;//黄字 TDBGrid(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State);
Brush.Color := C1;
Font.Color := C2 ;
end;
end;
end;
比如选中后的是红底黄字;
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
C1, C2: TColor;
begin
if gdSelected in State then
begin
with TDBGrid(Sender).Canvas do
begin
C1 := Brush.Color;
C2 := Font.Color; Brush.Color := ClRed;//红底
Font.Color := Clyellow;//黄字 TDBGrid(Sender).DefaultDrawColumnCell(Rect, DataCol, Column, State);
Brush.Color := C1;
Font.Color := C2 ;
end;
end;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货