2011-03-09 1 views
0

일반 Windows 탐색기 종류의 응용 프로그램을 구현하려고합니다. CpliterWnd에는 두 개의 창이 있습니다. 왼쪽 창은 CLeftTreeView : public CTreeView 오른쪽 창은 CRightPaneFrame : public CFrameWnd, CRightPaneFrame에는 멤버 변수 m_pCustomView가 있습니다.두 창으로 CSplitterWnd : 왼쪽 창은 CTreeView, 오른쪽은 CFrameWnd : 오른쪽 창에서 다른보기를 설정할 수 없음

있는 CustomView 내가 CRightPaneFrame 년에

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; 
} 

그리고 나중에

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는 다음과 같은 항목이 있습니다 (클래스 마법사를 리소스 편집기를 사용하여 추가 편집) 대화 상자 리소스에 추가 된 클래스입니다

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는 그렇지 않습니다. 오른쪽 창에로드되는 중.

접근 방식 변경에 대한 제안이나 현재 접근 방식의 문제점은 무엇입니까 ??

답변

0

사용자 지정보기를 CFrameWnd 안쪽이 아닌 오른쪽의 스플리터 창에 직접 넣어야합니다.

if (!m_SplitterWnd.CreateView(0, 0, RUNTIME_CLASS(CLeftTreeView), CSize(125, 100), pContext) 
|| !m_SplitterWnd.CreateView(0, 1, RUNTIME_CLASS(CCustomView), CSize(100, 100), pContext)) 

{ 
    m_SplitterWnd.DestroyWindow(); 
    return FALSE; 
} 
+0

감사합니다. dwo, 지연된 응답은 죄송합니다. – Ravi

관련 문제