[Lazarus] Stringgrid ?

Reinier Olislagers reinierolislagers at gmail.com
Sat Nov 17 20:17:12 CET 2012


On 17-11-2012 20:08, Reinier Olislagers wrote:
> If you get the answer you are looking for, please update the wiki [1],
> which was built by thousands of hours of volunteer work by me and many
> others, to help document Lazarus better.
> Thanks.
> 
> [1] http://wiki.lazarus.freepascal.org/Grids_Reference_Page

By the way, that wiki article says:
> Some properties can affect the way the grid looks by acting when the cell is about to be painted in PrepareCanvas/OnPrepareCanvas by changing default canvas properties like brush color or font. Following is a list of such properties: 
...
> Color. This sets the primary color used to draw non fixed cells background

Now when does the OnPrepareCanvas event happen?

In
> Description of grid's drawing process 
...
> OnPrepareCanvas. If the programmer wrote an event handler for
OnPrepareCanvas event, it is called at this point.
> This event can be used for doing simple customization like changing
cell's background color,

Which seems to confirm Juha's suggestion in his post: use
OnPrepareCanvas, which will be fired by the drawing cycle of the grid,
no need for you to specifically do something.

(From memory, may not be accurate)
In the Object Inspector, select the grid, then go to OnPrepareCanvas,
then click on the ellipses (...) which will give you the OnPrepareCanvas
event handler.
There modify the .Color property of the cell in question and see if tt
works.




More information about the Lazarus mailing list