媒体播放器控件
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MPlayer, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
OpenDialog1: TOpenDialog;
MediaPlayer1: TMediaPlayer;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
openDialog1.DefaultExt:='AVI';
opendialog1.Filter:='所有文件(*.*)|*.*|avi文件|*.avi';
openDialog1.FileName:='*.avi';
if opendialog1.Execute then
begin
mediaplayer1.FileName:=opendialog1.FileName;
mediaplayer1.Open;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
mediaplayer1.Next;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
mediaplayer1.Back;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
mediaplayer1.Pause;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
mediaplayer1.Play;
end;
end.