下面这段代码切换客户区的时候总是闪烁,研究发现导致闪烁的是RecalcLayout函数,但如果去掉RecalcLayout函数,客户区就切换不了,怎么办啊?
void CMainFrame::SwitchToForm(int nForm)
{
CView* pOldActiveView = GetActiveView(); // save old view
CView* pNewActiveView = (CView*)GetDlgItem(nForm); // get new view
if (pNewActiveView == NULL) // if it hasn't been created yet
{ // create it here
switch(nForm) // these IDs are the dialog IDs of the view but can use anything m_pDocument CXX0030: Error: expression cannot be evaluated{
case IDD_JZGL_FORM:
pNewActiveView = (CView*)new CJzGlView;
break;case IDD_DIALOGHYGL:
pNewActiveView = (CView*)new CHyGlView;
break;case IDD_JZGL_FORM1:
pNewActiveView = (CView*)new CQxWx;
break;default:
break;}CCreateContext context; // attach the document to the new view
pNewActiveView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault, // and the frame
this, nForm, &context);
}SetActiveView(pNewActiveView);
pNewActiveView->OnInitialUpdate();
::SetWindowLong(pNewActiveView->m_hWnd, GWL_ID, AFX_IDW_PANE_FIRST); // gotta have it
RecalcLayout(FALSE); // adjust frame
delete pOldActiveView; // kill old view }
切换客户区的时候屏幕总闪烁。
void CMainFrame::SwitchToForm(int nForm)
{
CView* pOldActiveView = GetActiveView(); // save old view
CView* pNewActiveView = (CView*)GetDlgItem(nForm); // get new view
if (pNewActiveView == NULL) // if it hasn't been created yet
{ // create it here
switch(nForm) // these IDs are the dialog IDs of the view but can use anything m_pDocument CXX0030: Error: expression cannot be evaluated{
case IDD_JZGL_FORM:
pNewActiveView = (CView*)new CJzGlView;
break;case IDD_DIALOGHYGL:
pNewActiveView = (CView*)new CHyGlView;
break;case IDD_JZGL_FORM1:
pNewActiveView = (CView*)new CQxWx;
break;default:
break;}CCreateContext context; // attach the document to the new view
pNewActiveView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault, // and the frame
this, nForm, &context);
}SetActiveView(pNewActiveView);
pNewActiveView->OnInitialUpdate();
::SetWindowLong(pNewActiveView->m_hWnd, GWL_ID, AFX_IDW_PANE_FIRST); // gotta have it
RecalcLayout(FALSE); // adjust frame
delete pOldActiveView; // kill old view }
切换客户区的时候屏幕总闪烁。
解决方案 »
- 如何重载按钮的windowproc,我想自己处理BM_SETCHECK和BM_GETCHECK两个消息。
- combox二次查询功能,类似ie
- 简单问题
- MFC编写exe,调用了ATL编写的COM DLL,为什么接口变化之后,在开发环境中反映不出来,但不影响使用。详情请进
- 关于picture!!
- 有哪个大哥能讲一下进度条的使用,多谢了,多谢了!
- ADO编程:大容量数据库访问的问题
- 如何在CMainFrame中却得CDialogBar(从对话框资源模板)创建的对话框的HWND?
- 关于注册表的读写
- 是不是硬盘坏了?格式化之有问题!
- 求大神指点编程获取windows本地安全设置中本地策略的审核策略
- 如何在word插入的activex控件中保存数据呢?
重建可不是就是简单调用OnPaint函数这么简单了。必定闪烁了。
重建可不是就是简单调用OnPaint函数这么简单了。必定闪烁了。
那怎么办,能给出方法吗?
要显示的显示ShowWindow(SW_SHOW)