到 DelphiArea.com下载一个PicShow的控件,有100%的源程序!!!

解决方案 »

  1.   

    不明白你的意思,不过给你一个淡入淡出的例子
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      ExtCtrls, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        Image1: TImage;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}procedure TForm1.Button1Click(Sender: TObject);
    var
      x,y,i: integer;
      BitMap : TBitMap;
      ptr : PByteArray;
    begin
      if GetDeviceCaps(Image1.Canvas.Handle,NUMCOLORS) <> -1 then
      begin
          ShowMessage('You must be in a high color mode to run this program');
          Close;
      end;
      BitMap := TBitMap.Create;
      try
          BitMap.LoadFromFile('factory.bmp');
          BitMap.PixelFormat := pf24bit;
          for i := 0 to 255 do begin
             for y := 0 to BitMap.Height - 1 do begin
                ptr := BitMap.ScanLine[y];
                for x := 0 to ((BitMap.Width * 3) - 1) do
                   if ptr[x] > 0 then ptr[x] := (ptr[x] - 1);
             end;
             Image1.Canvas.Draw(0,0,BitMap);
             Application.ProcessMessages;
          end;  finally
        BitMap.free;
      end;
    end;
    procedure TForm1.Button2Click(Sender: TObject);
    var
      x,y,i,j: integer;
      BitMap,bitmap2 : TBitMap;
      ptr,ptr1 : PByteArray;
    begin
      if GetDeviceCaps(Image1.Canvas.Handle,NUMCOLORS) <> -1 then
      begin
          ShowMessage('You must be in a high color mode to run this program');
          Close;
      end;
      BitMap := TBitMap.Create;
      bitmap2 := TBitmap.Create;
      try
          BitMap.LoadFromFile('factory.bmp');
          BitMap2.LoadFromFile('factory.bmp');
          BitMap.PixelFormat := pf24bit;
          bitmap2.pixelformat := pf24bit;
          for i:=0 to 255 do
          for y:=0 to bitmap2.height -1 do
          begin
            ptr:=bitmap2.scanline[y];
            for x := 0 to ((BitMap2.Width * 3) - 1) do
               ptr[x]:=0;
          end;
          for i := 0 to 255 do begin
             for y := 0 to BitMap2.Height - 1 do
             begin
                ptr := BitMap2.ScanLine[y];
                ptr1 := bitmap.ScanLine[y];
                for x := 0 to ((BitMap2.Width * 3) - 1) do
                   if ptr[x] < ptr1[x] then ptr[x] := (ptr[x] + 1);
             end;
             Image1.Canvas.Draw(0,0,BitMap2);
             Application.ProcessMessages;
          end;  finally
        BitMap.free;
      end;end;end.