(1)創建一個工程文件
(2)選擇File|New Form創建一個窗體,設置其Name := Form2
(3)設置Form2.BorderStyle := bsNone
(4)在Form2上放置一個MedialPlayer構件
(5)在Form2上放置一個Panel構件,設置其Name := Panel1
(6)設置Panel1.Align := alClIEnt
(7)在Form1的Button1中增添以下的代碼:
procedure TForm1.Button1Click(Sender: TObject);
begin
with Form2 do
begin
Show; Windowstate := wsMaximized;
MediaPlayer1.Notify := false;
MediaPlayer1.Display := Panel1;
MediaPlayer1.FileName := 'C:Tempcool.avi';
MediaPlayer1.Open;
MediaPlayer1.DisplayRect := Form2.ClIEntRect;
MediaPlayer1.Play;
end;
end;
(8)在Form2的MediaPlayer1的OnNotify事件中添加以下的代碼
procedure TForm2.MediaPlayer1Notify(Sender: TObject);
begin
if MediaPlayer1.NotifyValue = nvSuccessful
then Form2.Close; end;