当前位置:   article > 正文

闪屏窗体SplashForm

splash form already showno

闪屏窗体。一个友好提示的窗体对话框。

//闪屏窗体
procedure ShowSplash(XX:string);
begin
  SplashDlg:=TSplashDlg.Create(Application);
  SetWindowPos(SplashDlg.Handle,HWND_TOPMOST,0,0,0,0,SWP_NOMOVE or SWP_NOSIZE);//置前并且不得到焦点
  SplashDlg.XX.Caption:=XX;
  SplashDlg.Show;
end;

窗体代码如下

unit OPSplash;

interface

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

type
  TSplashDlg = class(TForm)
    XX: TLabel;
    Timer1: TTimer;
    Shape1: TShape;
    Shape2: TShape;
    Shape3: TShape;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormShow(Sender: TObject);
  private
    ShowCount:Integer ;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  SplashDlg: TSplashDlg;

implementation

{$R *.dfm}

procedure TSplashDlg.FormCreate(Sender: TObject);
begin
  Top:=-6;
  ShowCount:=0;
end;

procedure TSplashDlg.Timer1Timer(Sender: TObject);
begin
  ShowCount:=ShowCount+1;
  if ShowCount>3 then
     Close ;
end;

procedure TSplashDlg.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:=caFree ;
end;

procedure TSplashDlg.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  AnimateWindow(handle,250,AW_HIDE+AW_VER_NEGATIVE);
end;

procedure TSplashDlg.FormShow(Sender: TObject);
begin
  Width:=20+XX.Width+30;
  Left:=(Screen.WorkAreaWidth-width) div 2;
  AnimateWindow(handle,250,AW_VER_POSITIVE);  //渐变
end;

end.

 

 

转载于:https://www.cnblogs.com/czty/archive/2013/01/30/2883201.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/309516
推荐阅读
相关标签
  

闽ICP备14008679号