On 07/07/2013 02:24 AM, Kamen Ketev wrote:
Hello, I want to change certain cells in StringGrid. Here is an example,
but it changes all cells. Any idea where is wrong?
procedure TForm1.StringGrid1Click(Sender: TObject);
var
i, j: integer;
begin
for i := 1 to 4 do
for j := 1 to 4 do Begin
if i=j
then StringGrid1.Font.Style := [fsBold]
else StringGrid1.Font.Style := [];
StringGrid1.Cells[i,j] := 'StrTest';
end;
end;
That's wrong. You're changing TStringGrid.Font. If you want to change
font of one (few) cells only then you should use OnDrawCell or something
similar where you can change canvas.Font per cell.
z.
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus