unit ShowAVI_;
interface
uses
Windows, Messages, SysUtils,
Classes,
Graphics, Controls,
Forms, Dialogs, StdCtrls, ComCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Animate1: TAnimate;
//
Animate компоненті
Button1: TButton; // Пуск-Стоп батырмасы
Button2: TButton; // келесі кадр
Button3: TButton; // алдыңғы кадр
RadioButton1: TRadioButton;
// барлық анимацияны қарап шығу
RadioButton2: TRadioButton;
// әр кадр бойынша қарап шығу
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations )
end;
var Form1: TForm1; // форма
CFrame: integer;
implementation {$R *.DFM}
procedure TForm1.Button2Click(Sender: TObject);
begin
if CFrame = 1
then
Button2.Enabled := True;
if CFrame < Animate1.FrameCount
then begin
CFrame := CFrame + 1;
Animate1.StartFrame := CFrame;
Animate1.StopFrame := CFrame;
Animate1.Active := True;
if CFrame = Animatel.FrameCount
then Button2.Enabled:=False;
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if CFrame = Animate1.FrameCount
then Button2.Enabled := True;
if CFrame > 1
then begin
CFrame := CFrame — 1;
Animate1.StartFrame := CFrame;
Animate1.StopFrame := CFrame;
Animate1.Active := True;
if CFrame = 1 // текущий кадр —
первый
then Form1.Button3.Enabled := False;
end;
end;
procedure TForml.RadioButtonlClick(Sender: TObject);
begin
Buttonl.Enabled:=True;
Form1.Button3.Enabled:=False ;
Form1.Button2.Enabled:=False;
end;
procedure TForm1.RadioButton2Click(Sender:TObject);
begin
Button2.Enabled:=True;
Buttons.Enabled:=False
Buttonl.Enabled:=False; end;
procedure TForm1.ButtonlClick(Sender: TObject);
begin
if Animate1.Active = False
then begin
Animate1.StartFrame:=l;
Animate1.StopFrame:=Animate1.FrameCount;
Animate1.Active:=True;
Button1.caption:='Стоп';
RadioButton2.Enabled:=False;
end
else
begin
Animate1.Active:=False;
Button1.caption:='Пуск';
RadioButton2.Enabled:=True;
end;
end;
end.
unit WinSound_;
interface
uses
Windows, Messages, SysUtils,
Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, MPlayer;
type
TForm1 =
class(TForm)
MediaPlayerl: TMediaPlayer; // медиаплеер
Label1: TLabel;
ListBox1: TListBox;
Label2: TLabel;
procedure FormActivate(Sender: TObject);
procedure ListBoxlClick(Sender: TObject);
procedure MediaPlayerlClick(Sender: TObject; Button: TMPBtnType;
var DoDefault: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
const
SOUNDPATCH='с:\winnt\media\';
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormActivate(Sender: TObject);
var
SearchRec: TSearchRec;
begin
Form1.MediaPlayer1.Play ;
if FindFirst(SOUNDPATCH+'*.wav', faAnyFile, SearchRec) =0
then
begin
Form1.ListBox1.Items.Add(SearchRec.Name) ;
while (FindNext(SearchRec) = 0) do
Form1.ListBox1.Items.Add(SearchRec.Name);
end;
end;
procedure TForm1.ListBoxlClick(Sender: TObject);
begin
Label2.Caption:=ListBox1.Items[ListBox1.itemlndex];
procedure TForm1.MediaPlayerlClick(Sender: TObject; Button: TMPBtnType;
var DoDefault: Boolean);
begin
if (Button = btPlay)
and (Label2.Caption
<> '') then