Hi folks, I'm trying to write a handler to get TStringGrid to vary colours for certain cells. From my reading, I should just have to hook OnDrawCell and do something like this below, but if I do this, there is no sign of my event doing a thing (though a breakpoint shows it IS called).
Could someone let me know what I'm missing? (I have tried changing the DefaultDraw property, makes no difference to this scenario except that False means even the underlying/original appearance and cell data is not drawn. Also inspected the TStringGrid source -- nothing obvious leaps out!). procedure TmyForm.sgrdDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin inherited; with Canvas do begin font.color := clRed; Canvas.TextRect(Rect, Rect.Left+2, Rect.Top+2, 'RED HERE'); end; end; And if you have a solution to that, can anyone advise if there is a clever way to draw DIFFERENT colours within the cell, viz (something like): with Canvas do begin font.color := clRed; Canvas.TextOut(Rect.Left+2, Rect.Top+2, 'RED'); font.color := clBlue; Canvas.TextOut(Rect.Left+2+PenPos.X, Rect.Top+2+PenPos.Y, 'BLUE'); end; Since I can't even get to first base, needless to say the above doesn't work for me <g>. cheers, peter =========================================== Peter Hyde, SPIS Ltd, Christchurch, New Zealand * TCompress/TCompLHA component sets for Delphi/Kylix/C++ * TurboNote+: http://TurboPress.com/tbnote.htm -- top-rated onscreen sticky notes * Web automation for online periodicals: http://TurboPress.com Find all the above and MORE at http://spis.co.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/