|
|
导航: |
论坛 -> DELPHI技术
斑竹:liumazi,sephil |
|
作者: |
|
2004/5/13 14:12:14 |
标题: |
关于DBGrid单元格着色--高手大侠请进 |
浏览:1213 |
|
加入我的收藏 |
楼主: |
在发贴之前我把老贴都看了,几乎全是下面的程序: procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if Column.FieldName = 'fname' then begin DBGrid1.Canvas.Font.Color := clRed; DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State); end; if Column.Field.AsString ='Chang' then begin DBGrid1.Canvas.Font.Color := clBlue ; DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State); end; end; 这个着色的办法是在数据加载的时候加上的, 能不能写一个函数想给哪个格着色就给哪个格着色,可以在任何过程函数里引用它; procedure PaintCell(ACol:integer,ARow:Integer,color:Tcolor) begin //如何写一直没有想出头绪来,当然不能影响原来的操作所画上的颜色 end;
----------------------------------------------
- |
|