GREAT !

Thats almost perfect :)  I had already tried the DrawColumnCell event but
didnt include the final call.

    // must call this line at end
    DBGrid.DefaultDrawColumnCell(Rect,DataCol,Column,State);

Thanks for your help.


Robert Martin
Software Engineer
Wild Software Ltd
----- Original Message -----
From: "Alan Rose" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Thursday, August 16, 2001 4:03 PM
Subject: RE: [DUG]: DB Grids


> Use the DBGrids DrawColumnCell event
> Example
>
> procedure TfrmMain.DBGrid1DrawColumnCell(Sender: TObject;
>   const Rect: TRect; DataCol: Integer; Column: TColumn;
>   State: TGridDrawState);
> begin
>
>  with (Sender as TDBGrid).Canvas do
>     begin
>
>     // here we are testing if this row is selected
>       If gdSelected in State Then  // if selected
>         begin
>           Brush.Color:=clBlue; file://highlight row in blue
>           Font.Color:=clWhite; file://further hilite cell
>         end;
>
>     // example of testing a field value
>       case DataCol of
>       0: begin // first row
>              if column.Field.AsString <> '' then // test a condition etc
>                begin
>                  If gdSelected in State Then  // if selected different
> colour etc
>                    Font.Color:=clLime
>                  else
>                    Font.Color:=clRed;
>                end;
>            end;
>       end; // end case
>
>     End;
>
> // must call this line at end
>  DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
>
> end;
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Robert Martin
> Sent: Thursday, August 16, 2001 3:35 PM
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: DB Grids
>
>
> Re my earlier question re TDBGrid.  I know how to stop entry of the 2
> display records, the only (small I hope) hurdle is the colouring of
> indiviual record lines.
>
> Does anyone know how to change the background colour OR font style OR Font
> Colour for an individual row in a TDBGrid.
>
> Robert Martin
> Software Engineer
> Wild Software Ltd
> ----- Original Message -----
> From: Robert Martin
> To: Multiple recipients of list delphi
> Sent: Tuesday, October 16, 2001 9:12 AM
> Subject: [DUG]: DB Grids
>
>
> Hi
>
> We have an app where we want in grid DB editing.  We would like a table
> where 3 records are displayed per item, one for user entry and two that
> display related stock values.  We know in standard db grids we can disable
> column editing and change its color.
>
> 1: Can we disable entry in two out of every three rows?
> 2: Less importantly can we change the colour of the two detail rows?
>
> If number 1 is impossible (which I suspect it is) which alternative grids
> would you recommend?
>
>
> TIA Rob
>
>
> Robert Martin
> Software Engineer
> Wild Software Ltd
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to