0
我想實現一個經典的Windows資源管理器類應用程序, CpliterWnd有兩個窗格:左窗格是CLeftTreeView: public CTreeView 右窗格是CRightPaneFrame:public CFrameWnd,CRightPaneFrame有一個成員變量m_pCustomView。CSplitterWnd與兩個窗格:左窗格是CTreeView,右是CFrameWnd:無法在右窗格中設置不同的視圖
CustomView是I類添加到對話框資源(編輯使用的資源編輯器,並添加類嚮導)
class CustomView : public CFormView
{
DECLARE_DYNCREATE(CustomView)
public: // Changed to public so that i can instantiate this view on heap
CustomView(); // protected constructor used by dynamic creation
virtual ~CustomView();
BOOL Create(LPCTSTR A, LPCTSTR B, DWORD C,
const RECT& D, CWnd* E, UINT F, CCreateContext* G); // To override the protected specifier of CFormView::Create()
MainFrame.cpp具有以下條目
if (!m_SplitterWnd.CreateView(0, 0, RUNTIME_CLASS(CLeftTreeView), CSize(125, 100), pContext) || !m_SplitterWnd.CreateView(0, 1, RUNTIME_CLASS(CRightPaneFrame), CSize(100, 100), pContext))
{
m_SplitterWnd.DestroyWindow();
return FALSE;
}
,後來在CRightPaneFrame
BOOL CRightPaneFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
m_pCustomView = new CustomView;
m_pCustomView->Create(NULL,NULL,0L,CFrameWnd::rectDefault,this,VIEW_CUSTOM, pContext);
SetActiveView(m_pCustomView);
m_pCustomView->ShowWindow(SW_NORMAL);
RecalcLayout();
return true;
}
我不知道我在做什麼錯,但CustomView不是在右窗格中加載。
關於改變方法的任何建議或目前的做法有什麼錯?
謝謝dwo,對不起,延遲響應。 – Ravi 2013-10-11 16:41:12