04-06-2008, 11:14 AM
السلام عليكم و رحمة الله تعالى وبركاته
تطبيق سهل مع الشرح لكيفية إنشاء شاشة ترحيـبية من عمل Frank de Hell
أعجبني فأحببت إرفاقه لأنه كما نقول " سهل ممتنع "
الكود للإفادة
آمل أنه مفيد
تحياتي
تطبيق سهل مع الشرح لكيفية إنشاء شاشة ترحيـبية من عمل Frank de Hell
أعجبني فأحببت إرفاقه لأنه كما نقول " سهل ممتنع "
الكود للإفادة
كود :
Project1.dpr
================================================================
program Project1;
uses
Forms,
unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Form2};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
================================================================
Unit1.pas
================================================================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, IniFiles;
type
TForm1 = class(TForm)
Checkbox1: TCheckBox;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
IniFile: TIniFile;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
Unit2;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
Splash: Boolean;
begin
Inifile := TIniFile.Create(Changefileext(application.exename, '.ini'));
with Inifile do
try
Splash:= ReadBool('ShowSplash','LastChoice', True );
Checkbox1.Checked := Splash;
if Splash then
begin
Sleep(1000);
Form2.Close;
Form2.Release;
end;
finally
Free;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
Splash: Boolean;
begin
Inifile := TIniFile.Create(Changefileext(application.exename, '.ini'));
Splash := Checkbox1.Checked;
with Inifile do
try
WriteBool('ShowSplash','LastChoice', Splash);
finally
Free;
end;
end;
end.
================================================================
Unit2.pas [Your splashscreen]
================================================================
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, IniFiles;
type
TForm2 = class(TForm)
private
public
end;
var
Form2: TForm2;
Splash: Boolean;
Inifile: TIniFile;
implementation
{$R *.dfm}
initialization
Inifile := TIniFile.Create(Changefileext(application.exename, '.ini'));
with Inifile do
try
Splash:= ReadBool('ShowSplash','LastChoice', True);
finally
Free;
end;
if Splash then
begin
Form2 := TForm2.Create(nil);
Form2.Show;
Form2.Update;
end;
end.آمل أنه مفيد
تحياتي


![[-]](https://delphi4arab.net/forum/D4A2020/collapse.png)