单文档视图全屏切换时闪烁
本帖最后由 VisualEleven 于 2013-06-18 16:40:23 编辑 如何解决单文档视图全屏切换时的闪烁问题,
//设置窗口全屏
void CMainFrame::FullScreenModeOn()
{
//隐藏菜单栏
SetMenu(NULL);
// 去除主窗口的标题
LONG style=::GetWindowLong(m_hWnd,GWL_STYLE);
style&=~WS_CAPTION;
::SetWindowLong(m_hWnd,GWL_STYLE,style);
//得到当前系统的分辨率
HDC hdc = ::GetDC(NULL); //获得屏幕设备描述表句柄;
int screenx=GetDeviceCaps(hdc,HORZRES); //获取屏幕水平分辨率;
int screeny=GetDeviceCaps(hdc,VERTRES); //获取屏幕垂直分辨率;
// 全屏显示
SetWindowPos(NULL,-8,-8,screenx+20,screeny+20,SWP_NOZORDER);
style=::GetWindowLong(this->m_hWnd,GWL_STYLE);
}
void CCarAssistantView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();
CMainFrame *pMain=(CMainFrame *)AfxGetApp()->m_pMainWnd; //获取主窗口指针
pMain->FullScreenModeOn();//调用全屏函数
}