请留下邮箱,我把源码发给你们,帮忙看看。
是关于在View中用CDialogBar调用对话框的问题

解决方案 »

  1.   

    一个单文档程序,添加了一个对话框(ID为IDD_LISTDLG),并向对话框中添加一个Tree Ctrl控件(ID_TREE),然后在View.h中添加CDialogBar  m_hFileList,然后在View.cpp中添加如下代码:
    int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
    {
    if (CWnd ::OnCreate(lpCreateStruct) == -1)
    return -1;
    // TODO: Add your specialized creation code here
    m_hFileList.Create(this,IDD_LISTDLG,CBRS_LEFT,10);
    return 0;
    }void CChildView::OnSize(UINT nType, int cx, int cy) 
    {
    CWnd ::OnSize(nType, cx, cy);

    // TODO: Add your message handler code here
    CRect Rect;
    GetClientRect(Rect);
    m_hFileList.MoveWindow(Rect);
    CWnd *FileTree;
    FileTree = m_hFileList.GetDlgItem(IDC_TREE);
    Rect.top = 5;
    Rect.left = 5;
    Rect.right -= 6;
    Rect.bottom -= 6;
    FileTree->MoveWindow(Rect);
    }
    最后为IDD_LISTDLG添加对话框类,并对TreeCtrl进行初始化,使其显示一个树形图,也就是说用此方法,把这个对话框中的树形图显示到视图中,但视图中并没有显示出来,也不出错,TreeCtl的初始化肯定没错,我在基于对话框的程序中试过了。
      

  2.   

    This dialog template should be created with  the  style  WS_CHILD and no other ;
    The template must not have the style WS_VISIBLE.确认一下:)[email protected]
      

  3.   

    不知道你在哪儿初使化TreeCtrl的,我在OnCreate里初试化没问题,改好后的程序已经发给你了,注意接收!