Einzelnen Beitrag anzeigen

Benutzerbild von Lucifer
Lucifer

Registriert seit: 29. Mär 2007
62 Beiträge
 
#3

Re: Stringgrid Felder bei Formcreate färben

  Alt 19. Jun 2008, 20:24
ok das hab ich zwar auch versucht

aber irgendwie läuft bei mir etwas schief

Delphi-Quellcode:
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var i,j:integer;
begin


  for i:=0 to 9 do
  begin
    for j:=0 to 9 do
    begin
      form1.stringgrid1.Cells[i,j]:=IntToStr(map[i,j]);
      if(map[i,j]=-1)then
      begin
        stringgrid1.Canvas.Brush.Color:=clred;
        stringgrid1.Canvas.FillRect(Rect);
      end
      else
      begin
        stringgrid1.Canvas.Brush.Color:=clgreen;
        stringgrid1.Canvas.FillRect(Rect);
      end;
    end;
  end;




end;
wenn ich das somache kommt ein komisches resultat raus.
Ich hab echt keine Ahnung wie ich es anstellen soll.
  Mit Zitat antworten Zitat