Color row of DBGrid
- From: "FrancoJommi" <franco.jommi@xxxxxx>
- Date: Fri, 29 Jun 2007 21:16:50 +0200
I change color of the 'current' record in a DBGrid using the
OnDrawColumnCell eventi with the following code:
if (gdFocused in State) or (gdSelected in State) then
begin
if BtnMod.Down then
MyDBGrid.Canvas.Brush.Color := clYellow
else
MyDBGrid.Options := DelegheDBGrid.Options + [dgRowSelect];
MyDBGrid.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
The problem I have is that it doesn't work exactly as I wanted. The first
time I show the DBGrid no record are hilighted though dgRowSelect is true.
Clicking on the BtnMod the focused row is correctly painted in yellow, since
dgRowSelect is true. But I need dgRowSelect to be false to edit the record
and if it is set to false, the cells are not painted in yellow.
Thanks in advance for any suggestions.
.
- Prev by Date: Re: Entering timer for long process
- Next by Date: Re: TWebbrowser plugin support
- Previous by thread: Datatype checking in DotNET
- Index(es):