标题:[求助]欢迎界面怎么制作
只看楼主
刘香
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2006-9-21
 问题点数:0 回复次数:6 
[求助]欢迎界面怎么制作
在登陆界面上进入后出现欢迎界面,5秒后自动进入主界面。
我在欢迎界面上放了一个timer控件,在timer事件中代码
procedure Thy_Form.Timer1Timer(Sender: TObject);
var i:integer;
begin
i:=timer1.Interval;
if i=5000 then

zjm_form.Show; //主界面
hy_form.Hide; //欢迎界面
end;


这样做的不对,结果是欢迎界面消失,主界面也不出来
各位高手帮帮忙啊
搜索更多相关主题的帖子: 界面 form timer 欢迎 制作 
2007-05-12 16:44
bccnme
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-5-5
得分:0 

Delphi--软件启动画面中启动状态的显示
在flashfrm窗體中
unit flash;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Gauges;
type
TFlashfrm = class(TForm)
Image1: TImage;
Gauge1: TGauge;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure RepaintForm;
public
{ Public declarations }
procedure BeginLoad;
procedure EndLoad;
procedure UpdateLoadStatus(const AStatusText: string; AProgress: Integer); end;
var
Flashfrm: TFlashfrm;
implementation
{$R *.dfm}
procedure tFlashfrm.BeginLoad;
begin
label1.Caption := '正在初始化程序...';
Gauge1.Progress := 0;
RepaintForm;
end;

procedure tFlashfrm.EndLoad;
begin
label1.Caption := '初始化完成';
Gauge1.Progress := 100;
RepaintForm;
end;
procedure tFlashfrm.RepaintForm;
begin
Show; Update; Sleep(500);
end;
procedure tFlashfrm.UpdateLoadStatus(const AStatusText: string; AProgress: Integer);
begin
label1.Caption := AStatusText;
Gauge1.Progress := AProgress; Sleep(500);
RepaintForm;
end;
procedure TFlashfrm.FormCreate(Sender: TObject);
begin
label1.Caption := '';
Gauge1.MinValue := 0;
Gauge1.MaxValue := 100;
end;
end.

在dpr窗體中(F8進入)
program Flashexe;
uses
Forms,
Windows,
Controls,
Messages,
flash in 'flash.pas' {Flashfrm},
Main in 'Main.pas' {Mainfrm},
frm1 in 'frm1.pas' {Frmfrm1};
{$R *.res}
var
hMutex: THandle;
FoundWnd: THandle;
ModuleName: string;

function EnumWndProc(hwnd: THandle; Param: Cardinal): Bool; stdcall;
var
ClassName, WinModuleName: string;
WinInstance: THandle;
begin
Result := True;
SetLength(ClassName, 100);
GetClassName (hwnd, PChar (ClassName), Length (ClassName));
ClassName := PChar(ClassName);
if ClassName = Tmainfrm.ClassName then
begin
SetLength(WinModuleName, 200);
WinInstance := GetWindowLong(hwnd, GWL_HINSTANCE);
GetModuleFileName (WinInstance, PChar (WinModuleName),
Length(WinModuleName));
WinModuleName := PChar(WinModuleName);
if WinModuleName = ModuleName then
begin
FoundWnd := Hwnd;
Result := False;
end;
end;
end;

begin
HMutex := CreateMutex(nil, False, 'OneCopyMutex');
if WaitForSingleObject(hMutex, 0) <> WAIT_TIMEOUT then
begin
Application.Initialize;
Flashfrm := tFlashfrm.Create(nil);
try
with Flashfrm do
begin
BeginLoad;
Application.CreateForm(TMainfrm, Mainfrm);
// 加載窗體
UpdateLoadStatus('正在加載模塊1......', 10);
// 加載窗體
Application.CreateForm(TFrmfrm1, Frmfrm1);
UpdateLoadStatus('正在加載模塊2......', 40);
// 加載窗體
UpdateLoadStatus('正在加載模塊3......', 60);
// 加載窗體
UpdateLoadStatus('正在加載模塊4......', 70);
// 加載窗體
UpdateLoadStatus('正在加載模塊5......', 80);
// 加載窗體
UpdateLoadStatus('正在加載模塊6......', 90);
// 加載窗體
Flashfrm.EndLoad;
end;
finally
Flashfrm.Free;
end;
Application.Run;
end
else
begin
SetLength(ModuleName, 200);
GetModuleFileName (HInstance, PChar(ModuleName), Length (ModuleName));
ModuleName := PChar(ModuleName);
EnumWindows(@EnumWndProc, 0);
if FoundWnd <> 0 then
begin
if not IsWindowVisible(FoundWnd) then
PostMessage(FoundWnd, wm_App, 0, 0);
SetForegroundWindow(FoundWnd);
end;
end;
end.

2007-05-12 18:03
刘香
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2006-9-21
得分:0 
楼上的辛苦哇
太复杂啦
来个简单的吧

2007-05-15 18:24
anthony634
Rank: 6Rank: 6
来 自:西南交大
等 级:贵宾
威 望:24
帖 子:653
专家分:10
注 册:2006-6-8
得分:0 

我写了很简单的,算是抛砖引玉吧:
program Project1;

uses
Forms,SysUtils,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};

{$R *.res}
var
i: Integer;
begin
Form2 := TForm2.Create(Form2);
Form2.Show;
Form2.Update;
for i := 0 to 1000 do//观察效果,可以在form1的oncreate事件加如延长时间的代码来代替这段。
begin
Form2.Caption := IntToStr(i);
Application.ProcessMessages;
end;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
//Application.CreateForm(TForm2, Form2);
Form2.Hide;
Form2.Free;
Application.Run;
end.

2007-05-15 19:09
yangdouya888
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-5-21
得分:0 
回复:(anthony634)我写了很简单的,算是抛砖引玉吧...

楼上太复杂了,靠
program splash;
uses
forms,MainFrm in 'MainFrm.pas'{MainForm},
SpashFrm in 'SplashFrm.pas'{Splashfrom};

{$R *.RES}
begin
Application.Initialzie;
SplashForm:=TSplashFrom.Create(Application);
SplashFrom.Show;
SplashForm.Update;

while Splashform.tmMainTimer.Enabled do
Application.ProcessMessages;
Application.CreateForm(TMainForm,MainForm);
SplashFrom.Hide;
SplashFrom.Free;
Application.Run;
end.

2007-05-21 00:35
刘香
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2006-9-21
得分:0 
已经解决
procedure Thy_Form.Timer1Timer(Sender: TObject);

begin
i:=i+1;
if i=3
then
begin
zjm_form.Show;
hy_form.Hide;
end
end;

2007-05-29 09:55
罗煜罗煜
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-11-20
得分:0 
taiyoucai la
2012-11-20 19:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-138827-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.180757 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved