I thought I'd just throw this out there:<br>I'm still having issues with CPU usage and my customized grid. How often is prepare canvas called? I would think only when the form would be moving or otherwise need moving, but I suspect it's being called constantly. The grid is quite customized, changing alignment for most cells, checking the strings of every single cell and changing their fonts and backgrounds accordingly.. I'll throw in the code if anyone's interested.<br>
<br><div class="gmail_quote">On Thu, Sep 17, 2009 at 6:08 AM, Luca Olivetti <span dir="ltr"><<a href="mailto:luca@wetron.es">luca@wetron.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
En/na Andrea Mauri ha escrit:<div class="im"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dear all,<br>
in my application I need to change the cell color of some cells in a DBGrid.<br>
I use the OnDrawColumnCell event. My DBGrid name is dbgLoadings here the OnDrawColumnCell event:<br>
<br>
procedure TfrmPCA.dbgLoadingsDrawColumnCell(Sender: TObject; const Rect: TRect;<br>
DataCol: Integer; Column: TColumn; State: TGridDrawState);<br>
begin<br>
if DataCol >= 2 then<br>
begin<br>
dbgLoadings.Canvas.Font.Color:= clWhite;<br>
dbgLoadings.Canvas.Brush.Color:= clRed;<br>
end;<br>
if DataCol >= 2 then<br>
dbgLoadings.DefaultDrawColumnCell<br>
(Rect, DataCol, Column, State);<br>
end;<br>
<br>
It does not work. The Font appears fuzzy coloured like if the white font is written upon the original balck one. And the foreground of the cell remain white.<br>
<br>
Any hint?<br>
Regards,<br>
Andrea<br>
</blockquote>
<br></div>
I leave DefaultDrawing to true and use the OnPrepareCanvas event to do that.<br>
See also<br>
<a href="http://wiki.freepascal.org/Grids_Reference_Page" target="_blank">http://wiki.freepascal.org/Grids_Reference_Page</a><br>
<br>
<br>
Bye<br><font color="#888888">
-- <br>
Luca Olivetti<br>
Wetron Automatización S.A. <a href="http://www.wetron.es/" target="_blank">http://www.wetron.es/</a><br>
Tel. +34 93 5883004 (Ext.133) Fax +34 93 5883007</font><div><div></div><div class="h5"><br>
<br>
--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org" target="_blank">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</div></div></blockquote></div><br>