CDockablePane 记忆界面布局的问题

it2022-05-05  141

CWinAppEx类的LoadCustomState()和SaveCustomState()用于向注册表读取和保存应用程序的界面信息,重载该方法可以取消自动记忆界面布局。

void CxxxApp::LoadCustomState() {     //设置为TRUE,则自动加载界面记忆     this->m_bSaveState = FALSE; } //保存界面状态值 void CxxxApp::SaveCustomState() {     //设置为TRUE,则自动保存界面记忆     this->m_bSaveState = FALSE; }取消自动记忆界面保存后,自己手动保存与加载: //整个主窗口关闭事件(系统消息事件) void CMainFrame::OnClose() {     // TODO: 在此添加消息处理程序代码和/或调用默认值     //保存界面状态     CString strSectionPath = ::AFXGetRegPath(_T("WorkSpace"));     if(!m_dockManager.SaveState(_T(strSectionPath) ,IDR_MAINFRAME)){         MessageBox(_T("保存界面布局出错!") , "提示" , MB_OK | MB_ICONWARNING);     }     CMDIFrameWndEx::OnClose(); } //加载保存的界面布局状态(自己加的函数),在App那边调用 BOOL CMainFrame::LoadMainFrmState() {     CString strSectionPath = ::AFXGetRegPath(_T("WorkSpace"));     return m_dockManager.LoadState(_T(strSectionPath) ,IDR_MAINFRAME); }

转载于:https://www.cnblogs.com/canger/p/4156534.html

相关资源:CDockablePane

最新回复(0)