Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Delphi 不使用播放按钮控件调整MediaPlayer的大小_Delphi_Activex_Ole_Windows Media Player - Fatal编程技术网

Delphi 不使用播放按钮控件调整MediaPlayer的大小

Delphi 不使用播放按钮控件调整MediaPlayer的大小,delphi,activex,ole,windows-media-player,Delphi,Activex,Ole,Windows Media Player,我想编写一个没有播放控件的可调整大小的WindowsMediaplayer(ActiveX)。它应该适合TPanels 我前一段时间不得不解决这个问题,在谷歌搜索了很多次之后,我发现这个方法很管用 将WindowsMedaiPlayer对象放在面板上,并将其对齐到alclient, 播放器控制区域可以通过ide或代码中设置的uiMode:=“none”隐藏 然后使用指定面板调整大小事件 uses Ole2; procedure TForm1.Panel1Resize(Sender: TObje

我想编写一个没有播放控件的可调整大小的WindowsMediaplayer(ActiveX)。它应该适合TPanels

我前一段时间不得不解决这个问题,在谷歌搜索了很多次之后,我发现这个方法很管用

将WindowsMedaiPlayer对象放在面板上,并将其对齐到alclient,
播放器控制区域可以通过ide或代码中设置的
uiMode:=“none”
隐藏

然后使用指定面板调整大小事件

uses Ole2;

procedure TForm1.Panel1Resize(Sender: TObject);
 const
    IID_IOleInPlaceObject: SYSTEM.TGUID = '{00000113-0000-0000-C000-000000000046}';
 var
  IOIPObj: IOleInPlaceObject;
 begin
  SYSTEM.IDispatch(WindowsMediaPlayer1.OleObject).QueryInterface(IID_IOleInPlaceObject, IOIPObj);
  IOIPObj.SetObjectRects(Panel1.ClientRect, Panel1.ClientRect);
 end;


procedure TForm1.Play;
 begin
  WindowsMediaPlayer1.uiMode := 'none';  //show no interface, this can be set from the ide
  WindowsMediaPlayer1.URL := 'movie.mpg';
  WindowsMediaPlayer1.stretchToFit := True;
  WindowsMediaPlayer1.Controls.play;
 end;
改编自

Ole2用于IOleInPlaceObject,我必须将
$(Delphi)\source\rtl\Win
添加到库路径中,以便Delphi找到它

(德尔福7,wmp 11)

额外功能:更易于使用的功能

并打电话给

  SmoothResizeMediaPlayer(WindowsMediaPlayer1, panel1.ClientRect, panel1.ClientRect);
  SmoothResizeMediaPlayer(WindowsMediaPlayer1, panel1.ClientRect, panel1.ClientRect);