如何让启动画面的FORM透明 ( 积分: 50 )

  • 主题发起人 主题发起人 timer000
  • 开始时间 开始时间
T

timer000

Unregistered / Unconfirmed
GUEST, unregistred user!
就是在主程序前启动的窗体,就像delphi启动前那个图一样。
窗体实现透明倒是好搞,但一旦用在启动窗体,因为它是在Application.Initialize;前启动,不知道怎么就一直出错……
 
begin
Application.Initialize;
// Application.CreateForm(TForm1, Form1); // 应该在这里做, 不要在INIT之前
Application.Run;
end.
 
var
i:integer=3;
{$R *.res}

begin
Application.Initialize;
Application.CreateForm(TDM, DM);
Application.CreateForm(TFm_main, Fm_main);
Fm_Login:=TFm_Login.Create(Application);
if Fm_Login.ShowModal <>2 then
begin
Fm_splash:=TFm_splash.Create(application);
Fm_splash.Show;
Fm_splash.Refresh;

Application.CreateForm(TFm_Store_In, Fm_Store_In);
fm_splash.PB_Status.Position:=fm_splash.PB_Status.Position+i; //1
Application.CreateForm(TFM_PowerManage, FM_PowerManage);
fm_splash.PB_Status.Position:=fm_splash.PB_Status.Position+i; //2
Application.CreateForm(TFM_ChangePassword, FM_ChangePassword);
fm_splash.PB_Status.Position:=fm_splash.PB_Status.Position+i; //3
Application.CreateForm(TFM_OperatorLog, FM_OperatorLog);

fm_splash.Close;
fm_splash.free;
Application.Run;
end
else
begin
Fm_Login.Free;
Fm_main.Free;
DM.Free;
Application.Terminate;
end;
 
Application.Initialize;
SplashForm := TSplashForm.Create(Application);
SplashForm.Show; //显示封面
SplashForm.Update; //强制更新封面
{下面通过一个定时器来延时}
while SplashForm.Timer1.Enabled do
Application.ProcessMessages;
Application.CreateForm(TForm1, Form1);
SplashForm.Hide; //隐藏封面
SplashForm.Free; //释放封面
Application.Run;


procedure TSplashForm.Timer1Timer(Sender: TObject);
begin
Timer1.Enabled := False;
end;

procedure TSplashForm.FormShow(Sender: TObject);
begin
self.AlphaBlend := True;
self.AlphaBlendValue := 160;
end;

procedure TSplashForm.FormCreate(Sender: TObject);
begin
self.BorderStyle := BsNone;
end;
 
alphablend设置为ture
form1.AlphaBlendValue:=多少就行
 
恩~我回去试试,分先加上
 
后退
顶部