Einzelnen Beitrag anzeigen

Benutzerbild von stahli
stahli

Registriert seit: 26. Nov 2003
Ort: Halle/Saale
4.336 Beiträge
 
Delphi 11 Alexandria
 
#8

AW: Panel geschmeidig ein- und ausblenden?

  Alt 16. Sep 2017, 15:55
Ich habe mal schnell meinen Schnipsel (auch als Anregung) rausgesucht.
Vielleicht kannst Du Dir davon etwas ableiten.
Ich habe ein aktuelles und ein Ziel-Rect. Das aktuelle Rects wird so lange verändert, bis die Zielpositionen erreicht sind.


Delphi-Quellcode:
    if (DropRect.IsEmpty) then
    begin
      if (not DropRectReal.IsEmpty) then
      begin
        X := DropRectReal.Left + (DropRectReal.Width div 2);
        Y := DropRectReal.Top + (DropRectReal.Height div 2);
        L := Max((X - DropRectReal.Left) div 4, 1);
        T := Max((Y - DropRectReal.Top) div 4, 1);
        R := Min((X - DropRectReal.Right) div 4, -1);
        B := Min((Y - DropRectReal.Bottom) div 4, -1);
        DropRectReal := TRect.Create(DropRectReal.Left + L, DropRectReal.Top + T,
          DropRectReal.Right + R, DropRectReal.Bottom + B);
      end;
    end
    else
    begin
      if (DropRectReal.IsEmpty) then
      begin
        X := DropRect.Left + (DropRect.Width div 2);
        Y := DropRect.Top + (DropRect.Height div 2);
        DropRectReal := TRect.Create(X, Y, X, Y);
      end;
      L := (DropRect.Left - DropRectReal.Left) div 4;
      T := (DropRect.Top - DropRectReal.Top) div 4;
      R := (DropRect.Right - DropRectReal.Right) div 4;
      B := (DropRect.Bottom - DropRectReal.Bottom) div 4;
      DropRectReal := TRect.Create(DropRectReal.Left + L, DropRectReal.Top + T,
        DropRectReal.Right + R, DropRectReal.Bottom + B);
    end;

    if (DropRectReal.Left <> DropRect.Left) or (DropRectReal.Top <> DropRect.Top) or
      (DropRectReal.Width <> DropRect.Width) or (DropRectReal.Height <> DropRect.Height) then
    begin
      NächstenSchrittVeranlassen;
    end;

Aber wenn Dein Ergebnis funktioniert, kannst Du Deinen Code letztlich auch einfach so als Jugendsünde drin lassen. Stört ja keinen.
Wenn es gut und stabil (ohne Abstürze) läuft, ist es doch i.O.
Angehängte Dateien
Dateityp: zip kurzesVideo.zip (379,7 KB, 16x aufgerufen)
Stahli
http://www.StahliSoft.de
---
"Jetzt muss ich seh´n, dass ich kein Denkfehler mach...!?" Dittsche (2004)
  Mit Zitat antworten Zitat