请问如何在dbgrid中让奇数行记录背景显示一种颜色、偶数行记录背景显示另一种颜色呢?最好有代码!谢谢!也就是说隔行背景显示相同颜色
解决方案 »
- 寻求控件:寻求一个可以选择背景图片,并可改变形状的Tpanel控件,或者可以让背景图的底色变透明的Tpanel控件?
- 如何判断是文件夹还是文件?
- 关于程序打包
- 加载动态链接库问题
- 问一个小题,顺便动散分!急,解决了就散分·在线
- 如何判断鼠标移动的时候左键是否按下?
- 编写代码的 7 条基本原则
- 如何解决“移过头”的问题?
- 请教读取word书签的问题
- 请教有关oracle返回结果集的问题
- 各位大哥问个具简单的问题,关于用Socket接收数据的问题,请指教!!!!!!!!!!
- 我做了一个管理系统DELPHI+ ADO+SQL SERVER 2K在我自己的电脑上能运行,把它装在同网段的别人的电脑上无法运行!!
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if (AdoQryWait.RecNo and $0001) = 1 then
begin
DbgWait.Canvas.Brush.Color := $00DDAAB8; // ur color
end
else
begin
DbgWait.Canvas.Brush.Color := $00F7FFFF; // ur color
end;
DbgWait.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
begin
with (Sender as TDbGrid).Canvas do
begin
Brush.Color:=$00FFFFC1;
FillRect(Rect);
end;
end;
(Sender as TDbGrid).DefaultDrawColumnCell(Rect,DataCol,Column,State);
我刚才把上面两位哥哥的写入程序,结果还是不行啊。
liuqifeiyu(liuqi) 报错如下:
[Error] Unit1.pas(38): There is no overloaded version of 'Rect' that can be called with these arguments
[Error] Unit1.pas(41): There is no overloaded version of 'Rect' that can be called with these arguments
[Error] Unit1.pas(41): Undeclared identifier: 'State'
[Fatal Error] Project1.dpr(5): Could not compile used unit 'Unit1.pas'
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
oldcolor: TColor;
oldpm: TPenmode;
begin
if (DBGrid1.DataSource.DataSet.RecNo mod 2)=1 then
begin
with (Sender as TDbGrid).Canvas do
begin
Brush.Color:=$00FFFFC1;
FillRect(Rect);
end;
end;
(Sender as TDbGrid).DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;