想要在DBGrid中令显示的记录如斑马条那样:
begin
case DataCol mod 2 = 0 of
true: DBGrid1.Canvas.Brush.Color:=clWhite;
false:DBGRid1.Canvas.Brush.Color:=$00DDE8FF;
end;
if ((State =[gdSelected]) or (State = [gdSelected,gdFocused])) then
if not DBGrid1.SelectedRows.CurrentRowSelected then
DBGrid1.Canvas.Brush.Color:=clRed;
DBGrid1.Canvas.Pen.Mode:=pmMask;
DBGrid1.DefaultDrawColumnCell(Rect,datacol,column,state);//这里总是提示出错.
end;
检查了很久,都解决不了,请问什么问题?是不是要设置DBGrid的某些属性,或者是要声明什么?
begin
case DataCol mod 2 = 0 of
true: DBGrid1.Canvas.Brush.Color:=clWhite;
false:DBGRid1.Canvas.Brush.Color:=$00DDE8FF;
end;
if ((State =[gdSelected]) or (State = [gdSelected,gdFocused])) then
if not DBGrid1.SelectedRows.CurrentRowSelected then
DBGrid1.Canvas.Brush.Color:=clRed;
DBGrid1.Canvas.Pen.Mode:=pmMask;
DBGrid1.DefaultDrawColumnCell(Rect,datacol,column,state);//这里总是提示出错.
end;
检查了很久,都解决不了,请问什么问题?是不是要设置DBGrid的某些属性,或者是要声明什么?
解决方案 »
- 怎么在服务器上作文件被下载次数的统计啊?
- 关于treeview节点的颜色
- 在线求救,我现在需要将一个0~64*1024*1024=67108864之间的整数转化为二进制数(0、1字符串),然后分别抽出该二进制字符串的前面几位和中
- 怎么才能把Word类型变成String型?
- 请问怎么选定一行?用什么快捷键?
- dbgrid的哪个事件像edit的onchange事件.
- 请问布丁,你介绍的那个地址里,有一个"全套数据库"是什么东西呀,关于什么的数据库呀?
- 如何将internet上的论坛等的用户登陆框放到我的机器上,,怎么用delphi实现?
- 有没有关于Delphi的聊天室?
- 在DbGrid中某列为下拉框,如何限制用户只能选择,不能输入?40分。
- ◆◆◆如何使一程序像QQ般可以缩到屏幕上边去,鼠标一指又出现??◆◆◆
- 窗体调用的问题~~
begin
DBGridEh1.Canvas.Brush.Color := $00FF0000;
end
else
begin
DBGridEh1.Canvas.Brush.Color := $00FFFFC2;
DBGridEh1.Canvas.font.Color := $00FF0002;
end;
DBGridEh1.DefaultDrawColumnCell(Rect,DataCol,Column,State);if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then//选取行
begin
DBGridEh1.Canvas.Font.Color :=clRed;
DBGridEh1.Canvas.Brush.Color :=clYellow;
DBGridEh1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
支持insert2003(高级打字员)的作法
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
case DataCol mod 2 = 0 of
true: DBGrid1.Canvas.Brush.Color:=clWhite;
false:DBGrid1.Canvas.Brush.Color:=$00DDE8FF;
end;
if ((State =[gdSelected]) or (State = [gdSelected,gdFocused])) then
if not DBGrid1.SelectedRows.CurrentRowSelected then
DBGrid1.Canvas.Brush.Color:=clRed;
DBGrid1.Canvas.Pen.Mode:=pmMask;
DBGrid1.DefaultDrawColumnCell(Rect,datacol,column,state);
end;在我机子上面运行正常
不兼容的类型:incompatible types.不知道到底什么问题?
因为在窗体中我使用了topGrid的第三方控件,产生冲突问题.把topGrid控件和声明删除后,使用DBGrid就正常了.