Board index » cppbuilder » DBGrids
Andrew
![]() CBuilder Developer |
Andrew
![]() CBuilder Developer |
DBGrids2003-07-15 07:30:55 PM cppbuilder22 Hi there, Is it possible to display certain rows in DBGrid in one color, and other rows in another color? Some commercial components can do that so surely there must be a way to do it yourself with just the standard DBGrid? Thanks for your help! |
Bob
![]() CBuilder Developer |
2003-07-16 12:05:45 AM
Re:DBGrids
"Andrew" < XXXX@XXXXX.COM >wrote:
QuoteIs it possible to display certain rows in DBGrid in one void __fastcall TForm1::DBGrid1DrawDataCell(TObject *Sender, const TRect &Rect, TField *Field, TGridDrawState State) { TCanvas *pCanvas = DBGrid1->Canvas; // do some kind of testing to determine what color to use if( State.Contains( gdSelected ) ) { pCanvas->Brush->Color = clBlack; pCanvas->Font->Color = clHighlightText; } else if( Field->FieldName == "Some Name" ) { } else if( Field->AsString == "Some Possible Value" ) { } else { pCanvas->Brush->Color = (TColor) RGB( 255, 247, 224 ); pCanvas->Font->Color = clBlack; } DBGrid1->DefaultDrawDataCell( Rect, Field, State ); } |
Remy Lebeau (TeamB)
![]() CBuilder Developer |
2003-07-16 01:47:39 AM
Re:DBGrids
"Andrew" < XXXX@XXXXX.COM >wrote in message
QuoteIs it possible to display certain rows in DBGrid Gambit {smallsort} |