procedure FadeOut(const Bmp: TImage; Pause: Integer); var BytesPorScan, counter, w, h: Integer; p: pByteArray; begin ifnot (Bmp.Picture.Bitmap.PixelFormat in [pf24Bit, pf32Bit]) then raise Exception.Create('Error, bitmap format is not supporting.'); try BytesPorScan := Abs(Integer(Bmp.Picture.Bitmap.ScanLine[1]) - Integer(Bmp.Picture.Bitmap.ScanLine[0])); except raise Exception.Create('Error!!'); end;
for counter := 1to256do begin for h := 0to Bmp.Picture.Bitmap.Height - 1do begin P := Bmp.Picture.Bitmap.ScanLine[h]; for w := 0to BytesPorScan - 1do if P^[w] > 0then P^[w] := P^[w] - 1; end; Sleep(Pause); Bmp.Refresh; end; end;
procedure TForm1.Button2Click(Sender: TObject); begin FadeOut(Image1, 1); end;
Взято с сайта http://www.swissdelphicenter.ch/en/tipsindex.php