您的位置:首页 > 其它

MFC基于对话框的Media Player如何实现全屏显示功能?

2013-06-24 18:09 507 查看
MFC基于对话框的Media Player如何实现全屏显示功能?

BOOL CPlay::SwitchFullScreen(BOOL bFullScreen)
{
    CWnd* parentWnd = this->GetParent();
    if ( NULL == m_ParentWnd && parentWnd != this->GetDesktopWindow())
    {
        m_ParentWnd = parentWnd;
    }

    if (bFullScreen)
    {
        this->SetParent(NULL);
        ::SetWindowPos(this->GetSafeHwnd(), HWND_TOPMOST,-1,-1,-1,-1, SWP_NOMOVE|SWP_NOSIZE);
        this->ShowWindow(SW_MAXIMIZE);       
    }
    else
    {
        this->ShowWindow(SW_RESTORE);
        ::SetWindowPos(this->GetSafeHwnd(), HWND_TOPMOST,-1,-1,-1,-1,SWP_NOMOVE|SWP_NOSIZE);
        CRect parentBounds;
        m_ParentWnd->GetClientRect(parentBounds);

        this->SetParent(m_ParentWnd);
        this->MoveWindow(parentBounds);        
    }

    bFullScreen = !bFullScreen;
    
    return bFullScreen;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: