dxdbgrid 单元格中颜色设置问题,如何设置表格中单个格的颜色,单行我会??

dongbocong 2003-12-04 02:32:08
dxdbgrid 单元格中颜色设置问题,如何设置表格中单个格的颜色,单行我会??
...全文
61 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ln521 2003-12-17
  • 打赏
  • 举报
回复
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if gdselected in state then
with dbgrid1.Canvas do
begin
brush.Color:=clred;//选择颜色为红色
brush.Style:=bssolid;
fillrect(rect);
end;
dbgrid1.DefaultDrawColumnCell(rect,datacol,column,state);
end;
这个我试过了一定行的
qufo 2003-12-16
  • 打赏
  • 举报
回复
dxdbgrid根本没有DrawColumnCell
只有 onCustomDrawCell。而且,代码写在那里根本没反应。
boytomato 2003-12-06
  • 打赏
  • 举报
回复
无语!!!
hotel9545 2003-12-05
  • 打赏
  • 举报
回复
单行怎么做啊?
boytomato 2003-12-04
  • 打赏
  • 举报
回复
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);

begin

if (TDbGrid(sender).Fields[DataCol].FieldName='工资') and (TDbGrid(sender).Fields[DataCol].asfloat>=1000) then


begin

DBGrid1.Canvas.Font.Color := clblue;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;


if (TDbGrid(sender).Fields[DataCol].FieldName='工资') and (TDbGrid(sender).Fields[DataCol].asfloat<1000) then


begin

DBGrid1.Canvas.Font.Color := clred;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;



end;



dongbocong 2003-12-04
  • 打赏
  • 举报
回复
兄弟们帮帮忙???
dongbocong 2003-12-04
  • 打赏
  • 举报
回复
不可能这么做,能实现吗???
47522341 2003-12-04
  • 打赏
  • 举报
回复
dbgrid1.Columns[1,1].Color := clred;

5,392

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧