提问:关于视图窗口,麻烦帮我看一下代码有没有问题
 #include<afxwin.h>
#include<afxext.h>
#include"resource.h"
// 1 应用程序类
class CMyWinApp :public CWinApp {
public:
    virtual BOOL InitInstance();
};
// 2 框架窗口类
class CMyFrameWnd :public CFrameWnd {
public:
    virtual BOOL OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext);

    CSplitterWnd SplitterWnd1;
    //CSplitterWnd SplitterWnd2;
};
// 3 视图窗口类
class CMyView :public CView {
    DECLARE_DYNCREATE(CMyView)
public:
    virtual void OnDraw(CDC *pDC);
};
IMPLEMENT_DYNAMIC(CMyView,CView)
CMyWinApp theApp;
BOOL CMyWinApp::InitInstance() {
    CMyFrameWnd *pFrame = new CMyFrameWnd;
    pFrame->LoadFrame(IDR_MENU1);
    m_pMainWnd = pFrame;
    pFrame->ShowWindow(SW_SHOW);
    pFrame->UpdateWindow();
    return TRUE;
}
BOOL CMyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) {

    SplitterWnd1.CreateStatic(this, 2,1);
    SplitterWnd1.CreateView(0, 0, RUNTIME_CLASS(CMyView), CSize(200, 200), pContext);
    SplitterWnd1.CreateView(1, 0, RUNTIME_CLASS(CMyView), CSize(200, 200), pContext);
    SplitterWnd1.SetActivePane(0, 1);

    return TRUE;
}
void CMyView::OnDraw(CDC *pDC) {

}

2个回答

解决了,IMPLEMENT_DYNAMIC 是 IMPLEMENT_DYNCREATE 插件自动改成DYNAMIC了 晕

那句 SplitterWnd1.SetActivePane(0, 1); 这段可以无视,复制代码忘记注释掉了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问