如何在全屏幕显示一个AVI文件

类别:Delphi 点击:0 评论:0 推荐:
(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:\Temp\cool.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;

本文地址:http://com.8s8s.com/it/it6219.htm