[求助]播放器无法实现全屏播放
unit Unit1;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Menus, MPlayer;
type
TForm1 = class(TForm)
OpenDialog1: TOpenDialog;
Timer1: TTimer;
MediaPlayer1: TMediaPlayer;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
Panel1: TPanel;
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure Panel1Resize(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.N2Click(Sender: TObject);
begin
//OpenDialog.FileName:='*.avi'; //设置被打开文件的扩展名
if OpenDialog1.Execute then
begin
Mediaplayer1.Close;//关闭
MediaPlayer1.Filename:=OpenDialog1.FileName;
//FileNameLabel.Caption:='当前播放文件:'
// +ExtractFileName(OpenDialog.FileName);
MediaPlayer1.Open;
//Form2:=TForm2.Create(Application);
//Form2.Show;
MediaPlayer1.display:=Panel1;
mediaplayer1.DisplayRect:=rect(0,0,Panel1.Width,Panel1.Height);
MediaPlayer1.Play;
MediaPlayer1.Next;
//EndPositon:=MediaPlayer1.Position;
MediaPlayer1.Rewind;
if MediaPlayer1.Mode=mpPaused then
begin
MediaPlayer1.Resume;
end
else
begin
MediaPlayer1.Open;
//Form2:=Tform2.Create(Application);
//Form2.Show;
MediaPlayer1.display:=Panel1;
mediaplayer1.DisplayRect:=rect(0,0,Panel1.Width,Panel1.Height);
MediaPlayer1.Play;
end;
Timer1.Enabled:=True;
end;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
close;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
if MediaPlayer1.Mode=mpPaused then
begin
MediaPlayer1.Resume;
end
else
begin
MediaPlayer1.Open;
MediaPlayer1.display:=Panel1;
mediaplayer1.DisplayRect:=rect(0,0,Panel1.Width,Panel1.Height);
MediaPlayer1.Play;
end;
Timer1.Enabled:=True;
end;
procedure TForm1.N6Click(Sender: TObject);
begin
MediaPlayer1.Pause;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
MediaPlayer1.Rewind;
MediaPlayer1.Play;
end;
procedure TForm1.Panel1Resize(Sender: TObject);
begin
end;
end.
这是我的程序,我先是用PANEL1作为播放区域的,想实现鼠标可以把屏幕拖大拖小,是拖FORM,屏幕随着变大变小,这就是那的程序,我刚请教一朋友,说在Panel1Resize里编写
mediaplayer1.align:=alClient;
form1.activecontrol:=nil;
form1.activecontrol:=mediaplayer1;
可是我写上了,他说可以实现屏幕随FORM的大小变大变小,可是我写上不管用,FORM可以拖大,但是屏幕就是固定的,不能变大变小,麻烦大家给看看