现在的位置: 首页 > 综合 > 正文

VC MFC 全屏的快捷实现方法

2013年01月01日 ⁄ 综合 ⁄ 共 544字 ⁄ 字号 评论关闭

// 设置全屏显示标志
m_bFullScreen=!m_bFullScreen;

//全屏显示
LONG style = ::GetWindowLong(this->m_hWnd,GWL_STYLE);

if(m_bFullScreen)  
{
    style &= ~(WS_DLGFRAME | WS_THICKFRAME);
    SetWindowLong(this->m_hWnd,GWL_STYLE, style);
    this->ShowWindow(SW_SHOWMAXIMIZED);
    CRect rect;
    this->GetWindowRect(&rect);
    ::SetWindowPos(this->m_hWnd,HWND_NOTOPMOST,rect.left-1, rect.top-1, rect.right-rect.left + 3, rect.bottom-rect.top + 3, SWP_FRAMECHANGED);
    
}
else   
{
    style |= WS_DLGFRAME | WS_THICKFRAME;
    SetWindowLong(this->m_hWnd, GWL_STYLE, style);
    this->ShowWindow(SW_NORMAL);
    
}

抱歉!评论已关闭.