Ik heb nu een stringgrid en di vul ik met wat onzin tekst m.b.v. deze code
Code:
procedure TfrmRisiciGraaf.InitGrid;
var
y, x: Integer;
begin
sgRisicoGraaf.ColCount := 8;
sgRisicoGraaf.RowCount := 6;
for x := 0 to sgRisicoGraaf.ColCount - 1 do
begin
sgRisicoGraaf.Cells[0, x] := 'TekstX ' + IntToStr(x);
for y := 0 to sgRisicoGraaf.RowCount - 1 do
begin
sgRisicoGraaf.Cells[x, y] := 'TekstXY ' + IntToStr(x) + ' ' + IntToStr(y);
end;
end;
end;
Dat gaat prima. Maar zodra ik in de onDrawCell iets wil kleuren gaat het mis - Zie onderste deel van afbelding. Hier is de OnDrawCell code
Code:
procedure TfrmRisiciGraaf.sgRisicoGraafDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
if ARow = 0 then
sgRisicoGraaf.Canvas.Brush.Color := clRed;
if ACol = 0 then
sgRisicoGraaf.Canvas.Brush.Color := clBlue;
sgRisicoGraaf.Canvas.TextRect(Rect, Rect.Left, Rect.Right,sgRisicoGraaf.Cells[ACol, ARow]);
end;
Ik zie even niet wat ik fout doet. Iemand een idee?
Bookmarks