Delphi-PRAXiS
Seite 2 von 5     12 34     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Animierte Splash Form (https://www.delphipraxis.net/135464-animierte-splash-form.html)

Alois 12. Jun 2009 17:55

Re: Animierte Splash Form
 
Und hier die deutsche Ьbersetzung der Homepage:

Homepage in Deutsch http://www.bitoff.ru/animationsplash/

Gruss Alois

Andy BitOff 12. Jun 2009 18:05

Re: Animierte Splash Form
 
Zitat:

Zitat von Alois
Und hier die deutsche Ьbersetzung der Homepage:

Gruss Alois

:mrgreen: :thumb:

Super_Chemiker 12. Jun 2009 18:12

Re: Animierte Splash Form
 
Vielleicht eine blцde Frage, aber wie integriere ich so einen Splashscreen jetzt in ein Delphi Projekt? Ich wьsste nicht, wie ich das mit dem Dateityp als Formular festlege :wiejetzt:

mfG

Alois 12. Jun 2009 18:23

Re: Animierte Splash Form
 
Zitat:

Zitat von Super_Chemiker
Vielleicht eine blцde Frage, aber wie integriere ich so einen Splashscreen jetzt in ein Delphi Projekt? Ich wьsste nicht, wie ich das mit dem Dateityp als Formular festlege :wiejetzt:

mfG

Schau dir doch die Dateien im ASF Demo Full an.
Hier der Link: http://www.bitoff.ru/animationsplash/ASFDemoFull.zip

Gruss Alois ;)

ASFDemoMain.pas
Delphi-Quellcode:
unit ASFDemoMain;

interface

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

type
  Tfrm_Main = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Label2Click(Sender: TObject);
    procedure Label3Click(Sender: TObject);
    procedure LabelMouseEnter(Sender: TObject);
    procedure LabelMouseLeave(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frm_Main: Tfrm_Main;

{===================================================== }
// Хранит индекс текста, который надо будет менять в процессе
  ProgressTextItem: Integer;

implementation

uses
  ASFMain;

{$R *.dfm}

procedure Tfrm_Main.FormCreate(Sender: TObject);
begin
  // Установить индекс текущей иконки
  AnimationSplashForm.ProgressIconCurrentItem := 0;
  AnimationSplashForm.TextData.Items[ProgressTextItem].Text := 'Установка стилей...';
  // в мс. приблизительно
  AnimationSplashForm.LoadingSectionTime := 1000;
  // Имитация долгого безответного действия
  Sleep(1000);

  AnimationSplashForm.TextData.Items[ProgressTextItem].Text := 'Загрузка параметров...';
  AnimationSplashForm.IncCurrentSection;
  AnimationSplashForm.IncCurrentItemIcon;
  AnimationSplashForm.LoadingSectionTime := 3000;
  // Имитация долгого безответного действия
  Sleep(3100);

  AnimationSplashForm.TextData.Items[ProgressTextItem].Text := 'Инициализация COM...';
  AnimationSplashForm.IncCurrentSection;
  AnimationSplashForm.IncCurrentItemIcon;
  AnimationSplashForm.LoadingSectionTime := 1000;
  // Имитация долгого безответного действия
  Sleep(1600);

  AnimationSplashForm.TextData.Items[ProgressTextItem].Text := 'Подключение MUI...';
  AnimationSplashForm.IncCurrentSection;
  AnimationSplashForm.IncCurrentItemIcon;
  AnimationSplashForm.LoadingSectionTime := 1000;
  // Имитация долгого безответного действия
  Sleep(500);

  AnimationSplashForm.TextData.Items[ProgressTextItem].Text := 'Загрузка интерфейса...';
  AnimationSplashForm.IncCurrentSection;
  AnimationSplashForm.IncCurrentItemIcon;
  AnimationSplashForm.LoadingSectionTime := 2000;
  // Имитация долгого безответного действия
  Sleep(2000);

  AnimationSplashForm.TextData.Items[ProgressTextItem].Text := 'Запуск...';
end;

procedure Tfrm_Main.Label2Click(Sender: TObject);
begin
  Screen.Cursor := crHourGlass;
  ShellExecute(Application.Handle, nil,
      'mailto:ASF%20-%20Andy%20BitOff<asf@bitoff.ru>?subject=AnimationSplashForm',
      nil, nil, SW_SHOWNORMAL);
  Screen.Cursor := crDefault;
end;

procedure Tfrm_Main.Label3Click(Sender: TObject);
begin
  Screen.Cursor := crHourGlass;
  ShellExecute(Application.Handle, nil,
      PChar(TLabel(Sender).Hint),
      nil, nil, SW_SHOWNORMAL);
  Screen.Cursor := crDefault;
end;

procedure Tfrm_Main.LabelMouseEnter(Sender: TObject);
var
  a: Integer;
begin
  Screen.Cursor := crHandPoint;
  a := TLabel(Sender).Tag;
  TLabel(Sender).Tag := TLabel(Sender).Font.Color;
  TLabel(Sender).Font.Color := TColor(a);
end;

procedure Tfrm_Main.LabelMouseLeave(Sender: TObject);
begin
  LabelMouseEnter(Sender);
  Screen.Cursor := crDefault;
end;

end.
ASFDemoFull.dpr
Delphi-Quellcode:
program ASFDemoFull;

uses
  Forms,
  ASFDemoMain in 'ASFDemoMain.pas' {frm_Main},
  SysUtils,
  GDIPAPI,
  ASFLists in '..\..\ASFLists.pas',
  ASFMain in '..\..\ASFMain.pas';

{$R *.res}

var
  Anim1: TAnimationFrames;
  SplashImagePath, s: string;
  i: Integer;

begin
  SplashImagePath := ExtractFilePath(ParamStr(0)) + 'img\';

  AnimationSplashForm := TAnimationSplashForm.CreateFrom(SplashImagePath + 'Splash.png');
  // Здесь надо учесть, что центруется сплэш именно по размерам бэкграунда
//  AnimationSplashForm := TAnimationSplashForm.CreateEmptyBackGround(196, 273, 72, 72);

  // Показывать кнопку на Панели задач
  AnimationSplashForm.ShowTaskbarButton := True;
  // Заголовок онка, если ShowTaskbarButton = True
  AnimationSplashForm.SplashFormCaption := 'Загрузка...';
  // Отрисовывать окно поверх всех
  AnimationSplashForm.SplashFormTopMost := False;
  // Скорость проявления и затухания сплэша
  // зависимость от таймера, т.е. SetTimerInterval * FadeSpeed
  AnimationSplashForm.FadeSpeed := 7;
  // Установка интервала таймера
  AnimationSplashForm.SetTimerInterval(15);

// ТЕКСТ ПРОЦЕССА
  ProgressTextItem := AnimationSplashForm.TextData.AddNewItem;
  with AnimationSplashForm.TextData.Items[ProgressTextItem] do begin
    // Показывать текст
    Visible := True;
    // Показывать тень текста
    VisibleShadow := True;
    // Рект в котором отображается текст
    TextBox := MakeRect(20, 190, 145, 20);
    // цвет текста
    Color := $FFF0F0F4;
    // цвет тени
    ShadowColor := $FF6C6C39;
    // шрифт
    FontName := 'Verdana';
    FontSize := 11;
    // центровать по горизонтали
    PositionH := StringAlignmentCenter;
  end;

// ПРОГРЕСС БАР
  with AnimationSplashForm.ProgressBar^ do begin
    // Показывать прогресс бар
    BarVisible := True;
    // Показывать рамку прогресс бара
    BarBorderVisible := True;
    // размеры прогресс бара
    BarBox := MakeRect(27, 212, 130, 10);
    // цвет прогресс бара
    BarColor := $60FFFFFF;
    // цвет бордюра
    BarBorderColor := $80F0F0F0;
  end;


  // Создадим постоянный текст, например, номер версии
  i := AnimationSplashForm.TextData.AddNewItem;
  with AnimationSplashForm.TextData.Items[i] do begin
    Visible := True;
    Text := 'version: 1.0.0.0';
    TextBox := MakeRect(27, 252, 130, 10);
    FontSize := 8;
    FontStyle := FontStyleItalic;
    PositionH := StringAlignmentCenter;
  end;


// ИКОНКИ
  // Показывать иконки
  AnimationSplashForm.ProgressIconsVisible := True;
  // Скорость проявления иконок (в процентах) в зависимости от LoadingPartTime
  // 100 значит, что иконка будет проявляться всё время (LoadingPartTime),
  // 50 - проявится за половину времени
  AnimationSplashForm.IconFullPaintPercent := 100;
  // Задать анимацию появления иконок
  AnimationSplashForm.IconAnimation := iaFade;
  // Положение первой иконки - левый край
  AnimationSplashForm.IconPosLeft := 23;
  // Положение первой иконки - верхний край
  AnimationSplashForm.IconPosTop := 226;
  // Расстояние между иконками
  AnimationSplashForm.IconSpace := 2;
  // Сколько пикс.отступать от левого края пред.иконки.
  // Если это знач. = 0, то берется значение ширины пред.иконки
  AnimationSplashForm.IconStep := 25;
  // Теперь загружаем сами иконки
  AnimationSplashForm.Icons.LoadFromFile(SplashImagePath + 'Icons.dat');
{  // Первая загрузка из файлов и сохранение в один файл
  // Затем загрузка идет уже и того файла
  AnimationSplashForm.Icons.AddFromFile(SplashImagePath + 'Styles.png');   // 1
  AnimationSplashForm.Icons.AddFromFile(SplashImagePath + 'Properties.png');// 2
  AnimationSplashForm.Icons.AddFromFile(SplashImagePath + 'Com.png');      // 3
  AnimationSplashForm.Icons.AddFromFile(SplashImagePath + 'Mui.png');      // 4
  AnimationSplashForm.Icons.AddFromFile(SplashImagePath + 'Interface.png'); // 5
  AnimationSplashForm.Icons.SaveToFile(SplashImagePath + 'Icons.dat');}


// АНИМАЦИЯ
  // Подготовим анимацию
  AnimationSplashForm.AnimationsAddFromFile(SplashImagePath + 'Animation.dat');
{  // Первая загрузка из файлов и сохранение в один файл
  // Затем загрузка идет уже и того файла
  Anim1 := TAnimationFrames.Create;
  try
    Anim1.DelayBetweenImages := 3;
    // Пауза между повторами циклов анимации
    Anim1.DelayBetweenPassage := 0;
    Anim1.PositionLeft := 42;
    Anim1.PositionTop := 79;
    for I := 0 to 17 do begin
      s := IntToStr(i);
      if Length(s) = 1 then
        s := '0' + s;
      Anim1.AddFromFile(SplashImagePath + 'Animation ' + s + '.png');
    end;
    AnimationSplashForm.AnimationsAdd(Anim1);
    Anim1.SaveToFile(SplashImagePath + 'Animation.dat');
  finally
    Anim1.Free;
  end;}

  // Устанавливает количество частей для загрузки
  // Также автоматом ProgressBarCurrentPart ставится равной 1
  AnimationSplashForm.ProgressBarSectionsCount := 5;

  // Запустить Splash
  AnimationSplashForm.StartSplash;

  Application.Initialize;
  Application.CreateForm(Tfrm_Main, frm_Main);
  // Закрыть и уничтожить
  AnimationSplashForm.CloseSplash(30, True);

  Application.Run;
end.

mkinzler 12. Jun 2009 18:24

Re: Animierte Splash Form
 
lade dir doch die Demos herunter, der Quelltext ist dabei
http://www.bitoff.ru/animationsplash/demo.html

Andy BitOff 12. Jun 2009 18:36

Re: Animierte Splash Form
 
If you use SplashCreator is saved in the file can be downloaded as shown in ASFDemo - Antonn (ASFDemoAntonn.dpr)
Delphi-Quellcode:
begin
  ProgressTextItem := 0; //Index text to be changed

  // Create from the saved file
  AnimationSplashForm := TAnimationSplashForm.CreateFullFrom(ExtractFilePath(ParamStr(0)) + 'img\' + 'FullData.dat');

  Application.Initialize;
  Application.CreateForm(Tfrm_Main, frm_Main);

  // Close and destroy
  AnimationSplashForm.CloseSplash(30, True);

  Application.Run;
end.

Andy BitOff 15. Jun 2009 19:31

Re: Animierte Splash Form
 
New version 2.2.0
Changes:
+ OnKeyPress
+ OnKeyDown
+ OnKeyUp
+ ClosingAllow - to allow the closure splash (Default - True)
* Minor changes

SplashCreator version 1.1.0
Support properties ClosingAllow

transformed demo CustomDraw
We show how to paint as close to ESC and use the features ClosingAllow to block the closure of other ways.

http://www.bitoff.ru/animationsplash/index.html

Andy BitOff 16. Jun 2009 07:40

Re: Animierte Splash Form
 
Version 2.2.2
+ AttemptedClosure - a sign of attempted closure splash

Super_Chemiker 17. Jun 2009 14:45

Re: Animierte Splash Form
 
Danke an alle, wenn ich die Demo starten will, dann sagt der Debugger:
Code:
[DCC Fataler Fehler] ASFDemoMain.pas(35): F1026 Datei nicht gefunden: 'ASFMain.dcu'

Super_Chemiker 29. Jun 2009 16:25

Re: Animierte Splash Form
 
WeiЯ keiner Rat? :wink:


Alle Zeitangaben in WEZ +1. Es ist jetzt 10:15 Uhr.
Seite 2 von 5     12 34     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz