2009. szeptember 24., csütörtök

Zooming effect when minimizing windows


Problem/Question/Abstract:

In win95 or NT4, there's a 'zooming effect' when an application is minimized
to the taskbar or restored from the taskbar.
However, this zooming effect does not seem to be presented in Delphi applications.

Answer:

Yes, the reason for this is simple: if you click the minimize button of the
main form in a Delphi app, the main form is not minimized but hidden. In its
place the zero-size Application window is minimized. Having the animation
in place here gives some rather weird visiual effects so the VCl designers
decided to disable it.

You can switch the effect on or off with the following piece of code, which works for Win95 and for NT 4:

procedure TForm1.SwitchEffect(Sender: TObject);
var
  Inf: TAnimationInfo;
begin
  Inf.cbSize := sizeof(Inf);
  // 1 = switch it on,
  // 0 = switch if off
  Inf.iMinAnimate := 1;
  SystemparametersInfo(SPI_SETANIMATION, 0, @Inf, SPIF_SENDWININICHANGE);
end;

Nincsenek megjegyzések:

Megjegyzés küldése