windows media player 控件如何视频自动缩放以适应播放窗体?

解决方案 »

  1.   

    缩放窗体倒是很容易,
    关键在获取视频的分辨率大小.
    AVI倒好,要是RMVB,RM等,还等先分析它们的数据结构
      

  2.   

    In the WM_SIZE Handler of the window containing the player, add the
    following code:CWnd* pWnd = GetForegroundWindow();
    SetFocus(GetDesktopWindow());
    WMP.Hide();
    WMP.Show();
    SetFocus(&WMP);
    SetForeGroundWindow(pWnd);
      

  3.   

    to DentistryDoctor:
    media player 9,10 不管用.
      

  4.   

    楼主如果是要使视频适应窗口大小的话,
    只要调用CWMPlayer4的SetStretchToFit(true)既可。如是要窗口适应视频大小的话,
    用Player,Media对象(对应于MFC生成的CWMPPlayer4,CWMPMedia)就可以实现。
    首先调用CWMPPlayer4的GetCurrentMedia()获取CWMPMedia对象,
    再用CWMPMedia对象的GetImageSourceHeight(),GetImageSourceWidth()
    获得视频的高度和宽度,然后用SetWindowPos()设置控件大小就可以改变控件大小