我需要编这样一个程序,窗口是左右分割的。在工具栏上有一个CComBoBox控件,当该控件中选择不同的情况时,被分割的左右窗口对应不同的对话框和视图。或者只是左边的对话框发生变化。
请问我该怎么做?谢谢先!

解决方案 »

  1.   

    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if (!m_myslider.CreateStatic(this, 1, 2)) return false;if (!m_myslider.CreateView(0,1, RUNTIME_CLASS(CMyForm), CSize(0,0), pContext)) return false; DWORD dwf = CGfxOutBarCtrl::fDragItems|CGfxOutBarCtrl::fEditGroups|CGfxOutBarCtrl::fEditItems|CGfxOutBarCtrl::fRemoveGroups|
    CGfxOutBarCtrl::fRemoveItems|CGfxOutBarCtrl::fAddGroups|CGfxOutBarCtrl::fAnimation;
    // |CGfxOutBarCtrl::fSelHighlight;
        m_bar.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), &m_myslider, m_myslider.IdFromRowCol(0, 0), dwf);
    m_bar.SetOwner(this); imaLarge.Create(IDB_IMAGELIST1, 32, 0, RGB(128,128,128));
    imaSmall.Create(IDB_SMALL_IMAGELIST1, 16, 0, RGB(0,128,128)); m_bar.SetImageList(&imaLarge, CGfxOutBarCtrl::fLargeIcon);
    m_bar.SetImageList(&imaSmall, CGfxOutBarCtrl::fSmallIcon); wndTree.Create(WS_CHILD|TVS_HASLINES|TVS_LINESATROOT|TVS_HASBUTTONS|TVS_SHOWSELALWAYS, CRect(0,0,0,0), &m_bar, 1010);
    wndTree.SetImageList(&imaSmall, TVSIL_NORMAL); m_bar.SetAnimationTickCount(20); m_bar.SetAnimSelHighlight(200);
    HTREEITEM htm = wndTree.InsertItem("客户负责人", 0,0);
    HTREEITEM htm1 = wndTree.InsertItem("tree 2", 1,1, htm);
    wndTree.InsertItem("tree 3", 1,1, htm); for (int xx = 0; xx < 30; xx ++)
    {
    htm = wndTree.InsertItem("tree 1", 0,0);
    htm1 = wndTree.InsertItem("tree 2", 1,1, htm);
    wndTree.InsertItem("tree 3", 1,1, htm); htm = wndTree.InsertItem("tree 1", 0,0);
    htm1 = wndTree.InsertItem("tree asdasdasdadasdasdasdasdas2", 1,1, htm);
    wndTree.InsertItem("tree 3", 1,1, htm);
    }

    m_bar.AddFolder("客户负责人信息", 0);
    m_bar.AddFolderBar("客户信息", &wndTree);
    // m_bar.AddFolder("Folder 2", 1);
    // m_bar.AddFolder("Folder 3", 2);
    // m_bar.AddFolder("Folder 4", 3);
        try
    {
        _bstr_t sql = "select ID ,UserName,UserCNname from myuser" ;
    prs->Open(sql ,pconn.GetInterfacePtr(),adOpenDynamic,adLockReadOnly,adCmdText);
    }
    catch(_com_error *e)
    {
      AfxMessageBox(e->ErrorMessage());
    } while(!prs->EndOfFile)
    {   
          int i = prs->GetCollect("ID").lVal;
           CString str =prs->GetCollect("UserName").bstrVal;
      CString strcn = prs->GetCollect("UserCNname").bstrVal;
          strcn.TrimRight();
      m_bar.InsertItem(0, 0, strcn, 0, i);
    // _variant_t i;
    //     i.vt = VT_I4;
    // i.intVal = 1;
    //     FieldsPtr pf = prs->GetFields();
    // FieldPtr  pf1 = pf->GetItem(i);
    // _bstr_t  id = pf1->GetName();
      prs->MoveNext();



    }