我知道在单文档里怎么加,但在对话框里在那里加呢?

解决方案 »

  1.   

    用create一样加,只是设置一下父类
      

  2.   

    CRect rectWindow; 
    GetClientRect(rectWindow); 
    CRuntimeClass *pViewClass = RUNTIME_CLASS(CMyScrollView); 
    CCreateContext * pContext; 
    pContext = new CCreateContext; 
    pContext->m_pCurrentDoc = NULL; 
    pContext->m_pCurrentFrame = NULL; 
    pContext->m_pLastView = NULL; 
    pContext->m_pNewDocTemplate =NULL; 
    pContext->m_pNewViewClass = pViewClass; 
    CWnd * pWnd = NULL; 
    pWnd = DYNAMIC_DOWNCAST(CWnd,pViewClass->CreateObject()); 
    pWnd ->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,CRect(0,0,0,0),this,0,pContext); 
    delete pContext; 
    CMyScrollView * pScollView = DYNAMIC_DOWNCAST(CMyScrollView,pWnd);
    pScollView->SetScrollSizes( MM_TEXT, CSize(rectWindow.right - rectWindow.left-20, 
    rectWindow.bottom -rectWindow.top-100) ); 
    pScollView->MoveWindow(rectWindow.left,rectWindow.top,rectWindow.right - rectWindow.left-20, 
    rectWindow.bottom -rectWindow.top-100,TRUE); 
      

  3.   

    http://support.microsoft.com/kb/141751/en-us