(1)创建一个工程文件
(2)选择File|New Form创建一个窗体,设置其Name := Form1
(3)设置Form1.BorderStyle := bsNone
(4)在Form1上放置一个MedialPlayer构件
(5)在Form1上放置一个Panel构件,设置其Name := Panel1
(6)设置Panel1.Align := alClient
(7)在Form1的Button1中增添以下的代码:
procedure TForm1.Button1Click(Sender: TObject);
begin
with Form1do
begin
Show;
WindowState := wsMaximized;
MediaPlayer1.Notify := false;
MediaPlayer1.Display := Panel1;
MediaPlayer1.FileName := 'C:/Temp/cool.avi';
MediaPlayer1.Open;
MediaPlayer1.DisplayRect := Form1.ClientRect;
MediaPlayer1.Play;
end;
end;
(8)在Form1的MediaPlayer1的OnNotify事件中添加以下的代码
procedure TForm1.MediaPlayer1Notify(Sender: TObject);
begin
if MediaPlayer1.NotifyValue = nvSuccessful then
Close;
end;