private
{ Private declarations }
colorA:TColor;
colorB:TColor;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
colorA:=$00BFE4e2;
ColorBox2.Selected:=colorA;
colorB:=$00e3fbfb;
ColorBox1.Selected:=colorB;
end;
procedure TForm1.ColorBox1CloseUp(Sender: TObject);
begin
colorB:=ColorBox1.Colors[ColorBox1.ItemIndex];
DBGrid1.Invalidate;
end;
procedure TForm1.ColorBox2CloseUp(Sender: TObject);
begin
colorA:=ColorBox2.Colors[ColorBox2.ItemIndex];
DBGrid1.Invalidate;
end;
選中了顏色沒反應,,不知道哪里出問題。
uj5u.com熱心網友回復:
用一句DBGrid1.Invalidate;改變顏色是不行的。在DBGrid1的OnDrawColumnCell事件中寫
if (query1.RecNo mod 2)=0 then
begin
DbGrid1.Canvas.Brush.color:=clRed;
end else DbGrid1.Canvas.Brush.color:=clblue;
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/100420.html
標籤:語言基礎/算法/系統設計
