⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 splashscreenu.pas

📁 Threaded Splash Form on Screen in Delphi, show an example on how to make a threaded splashscreen
💻 PAS
字号:
unit SplashScreenU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TSplashForm = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

Procedure ShowSplashscreen;
Procedure HideSplashScreen;
Procedure ShowSplashScreenMessage( const S: String );

implementation

uses PBThreadedSplashscreenU;

{$R *.dfm}
var
  ThreadedSplashForm: TPBThreadedSplashscreen;

{: Create a hidden instance of the TSplashForm class and use it as a
   template for the real splash form. The template is only a convenience
   to be able to design the splash from in the IDE, it may serve as
   an about box as well, however. }
Procedure ShowSplashscreen;
  Var
    SplashForm: TSplashForm;
    bmp: TBitmap;
  Begin
    If Assigned( ThreadedSplashForm ) Then Exit;

    Splashform := TSplashform.Create( Application );
    try
      ThreadedSplashForm:= TPBThreadedSplashscreen.Create( nil );
      Try
        ThreadedSplashform.Left  := Splashform.Left;
        ThreadedSplashform.Top   := Splashform.Top;
        ThreadedSplashform.Center:=
           Splashform.Position in [ poScreenCenter, poMainFormCenter,
                                    poDesktopCenter ];
        bmp:= Splashform.GetFormImage;
        try
          ThreadedSplashform.Image := bmp;
        finally
          bmp.Free;
        end;
        ThreadedSplashForm.UseStatusbar  := True;
        // ThreadedSplashForm.TopMost := true;

        ThreadedSplashForm.Show;
      Except
        FreeAndNil(ThreadedSplashForm);
        raise;
      End; { Except }
    finally
      Splashform.Free;
    end;
  End;

Procedure HideSplashScreen;
  Begin
    FreeAndNil(ThreadedSplashForm);
  End;

Procedure ShowSplashScreenMessage( const S: String );
  Begin
    If Assigned( ThreadedSplashForm ) Then
      ThreadedSplashForm.ShowStatusMessage( S );
  End;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -