formContainer for delphi,是一个delphi form动画现实的组件

源代码在线查看: intro.pas

软件大小: 1670 K
上传用户: guo25621286
关键词: delphi formContainer form for
下载地址: 免注册下载 普通下载 VIP

相关代码

				unit Intro;
				
				interface
				
				uses
				  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
				  FormCont, StdCtrls, ExtCtrls;
				
				type
				  TFormIntro = class(TForm)
				    Panel: TPanel;
				    MemoText: TMemo;
				    PanelTransition: TPanel;
				    FormContainerTransition: TFormContainer;
				    ButtonTransition: TButton;
				    procedure FormCreate(Sender: TObject);
				    procedure ButtonTransitionClick(Sender: TObject);
				  private
				    Initialized: Boolean;
				
				    procedure ShowText;
				  public
				    procedure Initialize;
				    procedure GotoForm1;
				    procedure GotoForm2;
				  published
				    procedure FCGetExtraData(ExtraData: TFCExtraData);
				  end;
				
				var
				  FormIntro: TFormIntro;
				
				implementation
				
				uses TransEff, OneForm, AnOtherForm, teDrip, teWipe, teSlide;
				
				{$R *.DFM}
				
				procedure TFormIntro.FormCreate(Sender: TObject);
				begin
				  Initialized := False;
				  if Screen.PixelsPerInch > PixelsPerInch then
				    MemoText.Font.Size := 8;
				  MemoText.WordWrap := True;
				  GotoForm1;
				end;
				
				procedure TFormIntro.GotoForm1;
				var
				  Transition: TSlideTransition;
				begin
				  FormOneForm :=
				    TFormOneForm(FormContainerTransition.CreateForm(TFormOneForm));
				
				  Transition := TSlideTransition.Create;
				  try
				    Transition.Milliseconds := 500;
				    Transition.Direction    := tedOut;
				    Transition.PassSetting  := teTwoPasses;
				    Transition.Pass2Options.Reversed := True;
				    FormContainerTransition.ShowFormEx(FormOneForm ,True, Transition, nil,
				      fcfaDefault);
				  finally
				    Transition.Free;
				  end;
				end;
				
				procedure TFormIntro.GotoForm2;
				var
				  Transition: TDripTransition;
				begin
				  FormAnotherForm :=
				    TFormAnotherForm(FormContainerTransition.CreateForm(TFormAnotherForm));
				  SetWindowRgn(FormAnotherForm.Handle, CreateEllipticRgn(10, 10,
				    FormAnotherForm.Width-10, FormAnotherForm.Height-10), False);
				
				  Transition := TDripTransition.Create;
				  try
				    Transition.Milliseconds := 2000;
				    Transition.Direction := tedLeft;
				    FormContainerTransition.ShowFormEx(FormAnotherForm, True, Transition, nil,
				      fcfaCenter);
				  finally
				    Transition.Free;
				  end;
				end;
				
				procedure TFormIntro.ButtonTransitionClick(Sender: TObject);
				var
				  SaveCursor: TCursor;
				begin
				  SaveCursor := Screen.Cursor;
				  Screen.Cursor := crHourglass;
				  try
				    if FormContainerTransition.Form is TFormOneForm
				    then GotoForm2
				    else GotoForm1;
				  finally
				    Screen.Cursor := SaveCursor;
				  end;
				end;
				
				procedure TFormIntro.ShowText;
				var
				  TextTransition: TWipeTransition;
				  ContTransition: TSlideTransition;
				  BtnTransition: TSlideTransition;
				begin
				  TextTransition := TWipeTransition.Create;
				  try
				    TextTransition.Milliseconds := 2000;
				    TextTransition.Direction := tedDown;
				    TextTransition.BandWidth := 100;
				    TextTransition.Prepare(MemoText.Parent, MemoText.BoundsRect);
				    MemoText.Visible := True;
				    if TextTransition.Prepared then
				      TextTransition.Execute;
				  finally
				    TextTransition.Free;
				  end;
				
				  BtnTransition := TSlideTransition.Create;
				  try
				    BtnTransition.Milliseconds := 1000;
				    BtnTransition.Direction := tedRight;
				    BtnTransition.Prepare(ButtonTransition.Parent,
				      Rect(0, ButtonTransition.Top,
				        ButtonTransition.Left + ButtonTransition.Width,
				        ButtonTransition.Top + ButtonTransition.Height));
				    ButtonTransition.Visible := True;
				    if BtnTransition.Prepared then
				      BtnTransition.Execute;
				  finally
				    BtnTransition.Free;
				  end;
				
				  ContTransition := TSlideTransition.Create;
				  try
				    ContTransition.Milliseconds := 750;
				    ContTransition.Direction := tedOut;
				    ContTransition.Prepare(FormContainerTransition.Parent,
				      FormContainerTransition.BoundsRect);
				    FormContainerTransition.Visible := True;
				    if ContTransition.Prepared then
				      ContTransition.Execute;
				  finally
				    ContTransition.Free;
				  end;
				end;
				
				procedure TFormIntro.Initialize;
				begin
				  ShowText;
				  Initialized := True;
				end;
				
				procedure TFormIntro.FCGetExtraData(ExtraData: TFCExtraData);
				begin
				  MemoText               .Visible := True;
				  ButtonTransition       .Visible := True;
				  FormContainerTransition.Visible := True;
				end;
				
				end.
							

相关资源