BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to create colored rows in DBGrid

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Chris
Guest





PostPosted: Tue Oct 14, 2003 4:14 am    Post subject: How to create colored rows in DBGrid Reply with quote



Hi
I have tried using the OnDrawColumnCell event to color each row of the
record based on the record in the database. But the only problem i have is
that the data does not have any color. DefaultDrawing property is FALSE.

Can anyone advise how to perform this feature?

Thanks
Chris


Back to top
Lucio Fiore
Guest





PostPosted: Tue Oct 14, 2003 7:56 am    Post subject: Re: How to create colored rows in DBGrid Reply with quote




"Chris" <cchuah (AT) tycoint (DOT) com> ha scritto nel messaggio
news:3f8b780f (AT) newsgroups (DOT) borland.com...
Quote:
Hi
I have tried using the OnDrawColumnCell event to color each row of the
record based on the record in the database. But the only problem i have is
that the data does not have any color. DefaultDrawing property is FALSE.

Can anyone advise how to perform this feature?

Thanks
Chris



procedure dbgRisultatiDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
// DefaultDrawing property of the grid is FALSE

// Set the font properties for the current cell
dbgRisultati.Canvas.Font.Pitch := fpFixed;
dbgRisultati.Canvas.Font.Name := 'Courier';
dbgRisultati.Canvas.Font.Color := clBlue;
//

// Set the color of the row (in this case i have the property
dgRowSelect = True)
if gdSelected in State then
dbgRisultati.Canvas.Brush.Color := clHighlight
Else
dbgRisultati.Canvas.Brush.Color := clMoneyGreen;
End;
//

// Draw the cel
dbgRisultati.Canvas.FillRect(rect);
//

// Draw the text into the cell
dbgRisultati.Canvas.TextOut(Rect.Left + 2, Rect.Top + 2, sTesto);
//
end;


I Hope it's what you need

Lucio Fiore




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.