Einzelnen Beitrag anzeigen

zorakh

Registriert seit: 12. Okt 2008
21 Beiträge
 
#1

Zum verzweifeln- Farbe in den Cells

  Alt 13. Okt 2008, 20:47
Es klappt einfach cniht. Eingentlich will ich nur alle Felder meines Grids per Schleife rot färben.
über dieses Prinzip, aber es klappt einfahc nciht. Es färbt sich rein garnichts.
Woran kann das liegen?
Delphi-Quellcode:
for x:=0 to (max-1) do begin
for y:=0 to (max-1) do begin
  ColCords:=x;
  RowCords:=y;
  StringGrid1.repaint;
end;
end;

Und dann bei OnDraw Cells

procedure TForm1.TabelleDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  with TStringGrid(Sender).Canvas do begin
       if (ACol=ColCords) and (ARow=ColCords) then begin
          Brush.Color:= clRed;
          FillRect(Rect);
       end;
  end;
  Mit Zitat antworten Zitat