Search code examples
c#winformsmedia-player

Display issue for WIndows Media Player in winforms


I am developing some windows application, in which I have to use windows media player control for playing some voice files. My problem is, I want to display only the seek bar like below

enter image description here

And the windows media player control has one property called uiMode I am using it to make the control look like, but its not affecting to the media control. I decreased the size of control and fixed it to the size which I want in the above window. But when I execute the program the media control is displaying in full mode i.e., like below.

enter image description here

I am able to play some music file by assigning to the URL of the control and its playing fine, but the display should be like the first image in this question. Can any one help me to achieve this???


Solution

  • The MSDN article actually recommends hard-coding the height of the control to 40 to hide the play area. Mentioned in the Remarks section. I actually found using 44 to work better, possibly making up for the border size. Not exactly encouraging but I think all you got. Do test on a machine with Aero turned off. You'll want to set the size in the Load event so you're not affected by auto-scaling:

        protected override void OnLoad(EventArgs e) {
            axWindowsMediaPlayer1.ClientSize = new Size(axWindowsMediaPlayer1.ClientSize.Width, 44);
            base.OnLoad(e);
        }