比如将窗体分为左右两部分,在OnCreateClient
添加: m_splitter.CreateStatic(this, 1, 2);
m_splitter.CreateView(0, 0, RUNTIME_CLASS(CTabView), CSize(200, 400), pContext);
m_splitter.CreateView(0, 1, RUNTIME_CLASS(CTabView), CSize(400, 400), pContext); return TRUE;这样能正常运行
然后,但是,想让右边那个视图是多标签视图,该怎么弄。
我在网上搜到的办法都只是未切割窗体时做标签视图的办法,直接用那种办法运行时会出错BOOL CWnd::SetWindowPos(const CWnd* pWndInsertAfter, int x, int y, int cx,
int cy, UINT nFlags)
{
ASSERT(::IsWindow(m_hWnd));//在这里发生断言错误
……
请做过类似东东的,给个解决方案~~

解决方案 »

  1.   

    楼主右边用CTABCTRL吧,这个比较符合逻辑,因为是个控件。也符合楼主原来的需求。网上代码比较多,也比较容易操控。
      

  2.   

    同上,用CFormView类做基类,上面放CTabCtrl控件
      

  3.   

    回复2楼(VisualEleven):
    用你提供的方法又报错了,下面:BOOL CFormView::Create(LPCTSTR /*lpszClassName*/, LPCTSTR /*lpszWindowName*/,
    DWORD dwRequestedStyle, const RECT& rect, CWnd* pParentWnd, UINT nID,
    CCreateContext* pContext)
    {
    ASSERT(pParentWnd != NULL);
    ASSERT(m_lpszTemplateName != NULL); m_pCreateContext = pContext;    // save state for later OnCreate#ifdef _DEBUG
    // dialog template must exist and be invisible with WS_CHILD set
    if (!_AfxCheckDialogTemplate(m_lpszTemplateName, TRUE))
    {
    ASSERT(FALSE);          // 这里
    不直接派生于CView的类,似乎都要出错
      

  4.   

    你的对话框的Style是Child风格吗?
      

  5.   

    你直接在这个视图里放一个tabctrl控件不行么
      

  6.   

    1、我没有Doc类
    2、设置了对话框风格也不行啊
    3、直接派生于CView类的运行起来才没有问题
      

  7.   

    我的错,写错类名了,直接写了CFormView了。不过用派生于CFormView的方法好麻烦啊……
      

  8.   

    这几天做得断断续续,找了无数源码,又回到起点!我还是自己写从CView类直接派生的CTabView类,可以实现效果了~