m_wndEdit.Create(WS_VSCROLL|WS_CHILD|WS_VISIBLE|ES_AUTOVSCROLL|
ES_MULTILINE|ES_WANTRETURN,CRect(0,0,0,0),&m_wndMyBar2,101);
m_wndEdit.ModifyStyleEx(0,WS_EX_CLIENTEDGE);
//m_wndEdit.ShowWindow(SW_NORMAL);有无并不改变.上面是例子的代码,显示是正确的,放到我代码里面就不能显示了.我不理解为什么设为那个rect四个0000?不是就显示不了了吗?但例子是正确的.
我改了0,0,100,100可以显示出来,但是无法充满整个Dialogbar.
如何才能充满?

解决方案 »

  1.   

    CRect(0,0,0,0)表示Edit的大小,ni都設成0,当然看不到了
      

  2.   

    自己取的Dialogbar的大小,然後設置CRect的値
      

  3.   

    //这样自也是不行的,还是无法显示???m_wndMyBar2.GetClientRect(&rect);if(!m_edit.Create(WS_VSCROLL|WS_CHILD|WS_VISIBLE|ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN,rect,&m_wndMyBar2,101))
    return -1;
    m_edit.ModifyStyleEx(0,WS_EX_CLIENTEDGE);
    // m_edit.ShowWindow(SW_NORMAL);
      

  4.   

    继承CDialogBar类得
    CDialogBarExt
    .h
    /////////////////////////////////
    class CDialogBarExt : public CDialogBar  
    {
    public:
    CDialogBarExt();
    virtual ~CDialogBarExt();
    BOOL Create(CWnd* pParentWnd, UINT nIDTemplate,
    UINT nStyle, UINT nID);
    CEdit oEdit;
    };
    /////////////////////////////
    .cpp中的Create函数
    BOOL CDialogBarExt:: Create(CWnd* pParentWnd, UINT nIDTemplate,
    UINT nStyle, UINT nID)
    {
    if(!CDialogBar::Create(pParentWnd, nIDTemplate,nStyle, nID))
    return FALSE; CRect rc;
    rc.left=0;
    rc.top=0;
    CSize sz;
    sz=this->CalcFixedLayout(TRUE,FALSE);
    rc.bottom=sz.cx;
    rc.right=sz.cy;
    oEdit.Create(WS_VSCROLL|WS_CHILD|WS_VISIBLE|ES_AUTOVSCROLL|ES_MULTILINE|ES_WANTRETURN,rc,this,100);

    oEdit.ShowWindow(1);
    }
    //////////////////////////
    在CMainFrm.h中建立对象
    CDialogBarExt oDialogBarExt;
    在CMainFrm::OnCreate中添加
    oDialogBar.Create(this,IDD_DIALOG1,CBRS_TOP|WS_CHILD|WS_VISIBLE,IDD_DIALOG1);
    oDialogBar.ShowWindow(1);
    /////////////////////
    OK!