C
CookieTian
Unregistered / Unconfirmed
GUEST, unregistred user!
我想实现这样的效果,就是用mediaplayer播放mpg文件,display到本窗口的一个panel上,现在的问题是:无论panel多大,mediaplayer播放出来的画面都是该mpg的实际大小,而不会随着panel的大小而改变,(不需要程序中动态改变大小,不过发现动态改变时,整个画面都消失不见了),部分代码如下:
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
mediaplayer1.FileName := opendialog1.FileName;
mediaplayer1.PaintTo(panel1.Handle ,0,0);
mediaplayer1.DisplayRect := panel1.ClientRect;
mediaplayer1.Open;
mediaplayer1.Play;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
mediaplayer1.FileName := opendialog1.FileName;
mediaplayer1.PaintTo(panel1.Handle ,0,0);
mediaplayer1.DisplayRect := panel1.ClientRect;
mediaplayer1.Open;
mediaplayer1.Play;
end;
end;