DBGrid简单自绘(字体颜色、背景等)
void __fastcall TForm1::DBGrid1DrawColumnCell(TObject *Sender, const TRect &Rect, int DataCol, TColumn *Column, TGridDrawState State) { AnsiString name= Column->Field->DataSet->FieldByName("NAME")->AsString; if(name=="功能科室"&&DataCol==1) //只绘制name为功能科室行和第二列的交集 DBGrid1->Canvas->Font->Color=clRed; if(name=="心电图室") DBGrid1->Canvas->Font->Color=clGreen; if(name=="胃镜室") DBGrid1->Canvas->Brush->Color=clGreen; DBGrid1->DefaultDrawColumnCell(Rect,DataCol,Column,State);//是什么意思?? }
本博客注有“转”字样的为转载文章,其余为本人原创文章,转载请务必注明出处或保存此段。c++/lua/windows逆向交流群:69148232