AxWindowsMediaPlayer size in WPF applications

落爺英雄遲暮 提交于 2019-12-02 11:45:17

问题


I am using an AxWindowsMediaPlayer in a WindowsFormsHost in a WPF application.

I'm having problems with sizing the control.

  1. I need to hide the video part, and keep only the part with buttons and seek bar. (since I run audio)

  2. I need to adjust the WindowsFormsHost to only display this part.

I tried to resize the WindowsFormsHost manually so that it only shows the required part, but when I tested the program on different pc's it wasn't displayed properly. Some parts from the control were cropped.


回答1:


I know you want to hide the video with the uiMOde

awWindowsMediaPlayer.uiMode= "invisible";

But, this hide controls too...

For me, you have two solutions:

the first, you create your axWindowsPlayer form with 45pixel of height for display just the controls button.

the seconds, you hide all the form, and create all your button...

you've acces at the controls button with : (play button for sample)

axWindowsMediaPlayer.Ctlcontrols.play();

And you've acces to the settings with : (volume for sample)

axWindowsMediaPlayer.settings.volume = 25;

I also saw that it was possible to define a custom uiMode, but I did not find any information about that...




回答2:


You have two options.

  1. Set uiMode to invisible and define your own buttons (functions are accesable like: axWindowsMediaPlayer.Ctlcontrols.stop();).
  2. Set uiMode to mini or full and set height 40. It leaves control without video visible (link: http://msdn.microsoft.com/en-us/library/windows/desktop/dd562469%28v=vs.85%29.aspx)



回答3:


You can also hide status, bar and controls

axWindowsMediaPlayer.uiMode= "None";


来源:https://stackoverflow.com/questions/17949598/axwindowsmediaplayer-size-in-wpf-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!