Marco Web Center

[an error occurred while processing this directive]

Home: Code Repository: Mastering Delphi 5

Project ANIMBTN

Project Structure


ANIMBTN.DPR

program AnimBtn;

uses
  Forms,
  AnimBF in 'AnimBF.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

ANIMBF.PAS

unit AnimBF;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Animate1: TAnimate;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  hDiff: Integer;
begin
  Animate1.Parent := Button1;
  hDiff := Button1.Height - Animate1.Height;
  Animate1.SetBounds (hDiff div 2, hDiff div 2,
    Animate1.Width, Animate1.Height);
  Animate1.Active := True;
end;

end.

ANIMBF.DFM

object Form1: TForm1
  Left = 228
  Top = 107
  Width = 372
  Height = 223
  Caption = 'AnimBtn'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 56
    Top = 56
    Width = 249
    Height = 73
    Caption = 'Find'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -16
    Font.Name = 'MS Sans Serif'
    Font.Style = [fsBold]
    ParentFont = False
    TabOrder = 0
  end
  object Animate1: TAnimate
    Left = 8
    Top = 8
    Width = 48
    Height = 50
    Active = False
    CommonAVI = aviFindFile
    StopFrame = 23
  end
end