修改TDBGrid颜色?修改了(还没写入数据库的)的信息用红色标明。

LuoGD 2003-03-17 04:56:28
我自己原来实现了,现在又忘了。特请教大家。
...全文
35 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
LuoGD 2003-03-18
  • 打赏
  • 举报
回复
再提提!
LuoGD 2003-03-17
  • 打赏
  • 举报
回复
如果该cell的内容是修改了,或新加的(不管是什么值,还没UPDATE到表)都用红色表示,
已经UPDATE的数据用黑色表示。
这样用户能看出他做了那些修改。
LuoGD 2003-03-17
  • 打赏
  • 举报
回复
我的意思是:

col1
chifengwatch 2003-03-17
  • 打赏
  • 举报
回复
mark
wangxd 2003-03-17
  • 打赏
  • 举报
回复
根据不同条件变色
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{

if(State.Contains(gdSelected))
{
cx = Rect.Left;
cy = Rect.Top;

}

p = TPoint(cx,cy);
p =DBGrid1->ClientToScreen(p);
Label1->Caption=p.x;
Label2->Caption=p.y;
if (ADOTable1->FieldByName("name")->AsString=="dd" )
if( Column->FieldName=="title"||Column->FieldName=="name")
DBGrid1->Canvas->Font->Color = clRed;
else
DBGrid1->Canvas->Font->Color = clGreen;
else
DBGrid1->Canvas->Font->Color = clBlue;
DBGrid1->DefaultDrawColumnCell(Rect,DataCol, Column, State);

}
hjhwfw 2003-03-17
  • 打赏
  • 举报
回复
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender,
const TRect &Rect, int DataCol, TColumn *Column,
TGridDrawState State)
{
if(Query1->FieldByName("科室")->AsString=="内科")//条件自定义
{
((TDBGrid*)Sender)->Canvas->Brush->Color=clRed;//(TColor)RGB(100,100,200);
((TDBGrid*)Sender)->Canvas->Font->Color=clWhite;
}
((TDBGrid*)Sender)->DefaultDrawColumnCell(Rect,DataCol,Column,State);
}
Chxis 2003-03-17
  • 打赏
  • 举报
回复
ownerdraw?

604

社区成员

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

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