| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 | unit WelcomeFrm;interfaceuses  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,  Dialogs, ExtCtrls, jpeg, UtilMethods;type  TWelcomeForm = class(TForm)    imgWelcome: TImage;  private    { Private declarations }  public    { Public declarations }  end;function ShowWelcome: THandle;procedure HideWelcome;implementation{$R *.dfm}var  WelcomeForm: TWelcomeForm;const  // ½¥±ä×î´óʱ¼ä£¨ºÁÃ룩  MaxShowAnimateTime = 1500;  MaxHideAnimateTime = 700;function ShowWelcome: THandle;var  I: Integer;  iFirstTime: Cardinal;begin  WelcomeForm := TWelcomeForm.Create(nil);  if FileExists(GetAppFilePath + 'Welcome.jpg') then    WelcomeForm.imgWelcome.Picture.LoadFromFile(GetAppFilePath + 'Welcome.jpg');  Result := WelcomeForm.Handle;  WelcomeForm.Show;  iFirstTime := GetTickCount;  for I := 0 to 255 do  begin    if I mod 5 = 0 then    begin      WelcomeForm.AlphaBlendValue := I;      WelcomeForm.Update;      if GetTickCount - iFirstTime > MaxShowAnimateTime then        Break;    end;  end;  WelcomeForm.AlphaBlendValue := 255;  Sleep(2000);  SetForegroundWindow(WelcomeForm.Handle);end;procedure HideWelcome;var  I: Integer;  iFirstTime: Cardinal;begin  if WelcomeForm = nil then    Exit;  iFirstTime := GetTickCount;  for I := 255 downto 0 do  begin    if I mod 10 = 0 then    begin      WelcomeForm.AlphaBlendValue := I;      WelcomeForm.Update;      if GetTickCount - iFirstTime > MaxHideAnimateTime then        Break;     end;  end;  WelcomeForm.AlphaBlendValue := 0;  WelcomeForm.Free;  WelcomeForm := nil;end;end.
 |