布尔类型在数据网格控件中显示
是这样的,我用DBGrid绑定access中的数据库表,表中有一个字段是bool类型的,但是我想在DBGrid中显示为是/否而不是True/False.
我这样
void __fastcall TForm1::DBGrid2DrawColumnCell(TObject *Sender, const TRect &Rect, int DataCol, TColumn *Column,TGridDrawState State){ if(Column->Field->FieldName == "SpecialAlarm") { if(Column->Field->AsBoolean == False) { DBGrid2->Canvas->TextRect(Rect,Rect.Left,Rect.Top,"否"); } if(Column->Field->AsBoolean == True) { DBGrid2->Canvas->TextRect(Rect,Rect.Left,Rect.Top,"是"); } }}