Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2006, 11:20 AM
lspinks lspinks is offline
Senior Member
 
Join Date: Nov 2006
Posts: 244
Default OnDrawColumnCell

I use the following code to color rows in my grid

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
if gdSelected IN State then
begin
DBGrid1.Canvas.Brush.Color := clNavy;
DBGrid1.Canvas.Font.Color := clWhite;
end
else
if Table1.FieldByName('Own').AsBoolean = True then
begin
DBGrid1.Canvas.Brush.Color:= clSkyBlue;
DBGrid1.Canvas.Pen.Color:= clWindowText;
end
else
begin
DBGrid1.Canvas.Brush.Color:= clWindow;
DBGrid1.Canvas.Pen.Color:= clWindowText;
end;
DBGrid1.DefaultDrawColumnCell
(Rect, DataCol, Column, State);
end;


How can I do this same thing, but using the columns property to descrive all my columns. When I add columns, then i lose the functionality in the OnDrawColumnCell event

Thanks

Leon
Reply With Quote
  #2  
Old 12-03-2006, 01:48 PM
lspinks lspinks is offline
Senior Member
 
Join Date: Nov 2006
Posts: 244
Default RE: OnDrawColumnCell

SOLVED!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 10:49 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.