在View上创建Sub View并显示出来为什么总是失败?该如何处理
在View上创建Sub View并显示出来为什么总是失败?
我想在CMyView上再创建两个个View: CMyLeftView 和CMyRightView.
CMyView,CMyLeftView,CMyRightView都是CView的子类.
代码如下: 但CMyLeftView 并没有显示出来.
BOOL CMyView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
CView::Create(lpszClassName,lpszWindowName,dwStyle,rect,pParentWnd,nID,pContext);
CCreateContext Context;
CRuntimeClass* pClass = RUNTIME_CLASS(CMyLeftView);
m_pView = (CView*)(pClass-> CreateObject());
m_pView-> Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
rect, this, 0, &Context);
return TRUE;
}
------解决方案--------------------
切分窗口还是用CSplitterWnd.
我想在CMyView上再创建两个个View: CMyLeftView 和CMyRightView.
CMyView,CMyLeftView,CMyRightView都是CView的子类.
代码如下: 但CMyLeftView 并没有显示出来.
BOOL CMyView::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
CView::Create(lpszClassName,lpszWindowName,dwStyle,rect,pParentWnd,nID,pContext);
CCreateContext Context;
CRuntimeClass* pClass = RUNTIME_CLASS(CMyLeftView);
m_pView = (CView*)(pClass-> CreateObject());
m_pView-> Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS,
rect, this, 0, &Context);
return TRUE;
}
------解决方案--------------------
切分窗口还是用CSplitterWnd.