精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● Delphi>>数据库技术>>请问怎样为DBGrid动态改变底色?

主题:请问怎样为DBGrid动态改变底色?
发信人: pazee()
整理人: teleme(2000-12-06 17:47:01), 站内信件
【 在 xiaorj (DrX) 的大作中提到: 】
: 请说得详细点,谢谢!
: 请选择回复原作者的检查框,谢谢!

Sorry,没看请你的题目.

有个 TDBGrid.OnDrawColumnCell 事件
例如:
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TR
ect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if (DataCol=2) then begin
    DBGrid1.Canvas.Brush.Color:= clYellow;
    DBGrid1.Canvas.FillRect(Rect);
    DBGrid1.Canvas.Font.Color:= clRed;
    DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
  end;
end;

--
.------------------------------------------------. 
|                                    |           | 
| 吃饱了不饿;睡醒了不困。           |.===.      | 
| 这是放之四海皆准的真理!           {}o o{}     | 
`---------------------------------ooO--(_)--Ooo--' 

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.96.191.124]

[关闭][返回]