Delphi 10.4, testowałem tylko na Windows 8.1 ale przypuszczam, że to nie tego wina. Mam wrażenie, że kiedyś to robiłem za pomocą DrawAnimatedRects przy włączonym SPI_SETANIMATION ale teraz nie widać efektu. Nawet jak minimalizuję do traya przy bsSizeable to nie ma animacji. Okno jest tylko ukrywane. Przy bsSizeable system ładnie wszystko animuje ale programowo nie widać efektu. Jak pokazać tą animację? Za wszelkie rady z góry dzięki. Poniżej testowany kod DrawAnimatedRects:
uses
SysUtils, Classes, Math, ShellApi, Messages, Graphics, Windows, Forms,
Vcl.Controls, Vcl.StdCtrls, Vcl.Dialogs;
procedure ShowAnimation(Form: TForm);
implementation
function SetAnimation(Animation: Boolean; AI: TAnimationInfo): Boolean;
begin
FillChar(ai, SizeOf(AI), 0);
AI.cbSize := SizeOf(AI);
if Animation then
ai.iMinAnimate := 1
else
ai.iMinAnimate := 0;
Result := SystemParametersInfo(SPI_SETANIMATION, 0, @AI, SPIF_SENDCHANGE);
end;
function GetWindowAnimation(var AI: TAnimationInfo): Boolean;
begin
FillChar(AI, SizeOf(ai), 0);
AI.cbSize := SizeOf(AI);
if not SystemParametersInfo(SPI_GETANIMATION, AI.cbSize, @AI, SPIF_SENDCHANGE) then
RaiseLastOSError;
Result := not (AI.iMinAnimate = 0);
end;
procedure ShowAnimation(Form: TForm);
var
RectFrom, RectTo: TRect;
abd: TAppBarData;
AI: TAnimationInfo;
begin
if not (GetWindowAnimation(AI)) then
SetAnimation(True, AI);
FillChar(abd, SizeOf(abd), 0);
abd.cbSize := SizeOf(abd);
if SHAppBarMessage(ABM_GETTASKBARPOS, abd) = 0 then
Exit;
RectTo := abd.rc;
RectFrom := Application.MainForm.ClientRect;
if not (DrawAnimatedRects(Form.Handle, IDANI_CAPTION, RectFrom, RectTo)) then
ShowMessage('Error: DrawAnimatedRects');
end;