Einzelnen Beitrag anzeigen

Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.439 Beiträge
 
Delphi 10.4 Sydney
 
#12

Re: Rectangle zwischen 2 Kästen entfernen

  Alt 23. Nov 2009, 15:02
Delphi-Quellcode:
var
  z: ZlBereich;
  s: SpBereich;
  x1, y1, x2, y2: Integer;
  lZelle, lZelleR, lZelleU: TObject;
begin
  {erstmal komplett Schwarz}
  Canvas.Brush.Color := clBlack;
  Canvas.FillRect(Canvas.ClipRect);

  for z:=0 to zMax do
  begin
    for s:=0 to sMax do
    begin
      lZelle := lab.zelle[s,z];
      x1 := xWert(s);
      y1 := yWert(z);
      x2 := xWert(s) + ZW;
      y2 := yWert(z) + ZW;
      if Assigned(lZelle) then
        Canvas.Brush.Color := clBtnFace // belegte Zelle
      else
        Canvas.Brush.Color := clGray; // nicht belegte Zelle
      Canvas.FillRect(Rect(x1, y1, x2, y2));

      if Assigned(lZelle) then
      begin
        {Rand rechts übermalen}
        lZelleR := lab.zelle[s + 1, z];
        if Assigned(lZelleR) then
          Canvas.FillRect(Rect(x2, y1, xWert(s + 1), y2));
        {Rand unten übermalen}
        lZelleU := lab.zelle[s, z + 1];
        if Assigned(lZelleU) then
          Canvas.FillRect(Rect(x1, y2, x2, yWert(z + 1)));
        {Ecke rechts/unten}
        if Assigned(lZelleR) and Assigned(lZelleU) and
           Assigned(lab.zelle[s + 1, z + 1]) then
          Canvas.FillRect(Rect(x2, y2, xWert(s + 1), yWert(z + 1)));
      end;
    end;
  end;
end;
  Mit Zitat antworten Zitat