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);//是什么意思?? }
时间: 2025-01-30 06:46:47