在什么消息下添加初始化的方法?

解决方案 »

  1.   

    添加虚函数:OnInitialUpdate()
    在这个函数里面初始化你的控件。
      

  2.   

    你的控件是什么呀,是在Form的对话框里面么!!!
      

  3.   

    It wouldnt work from CView::OnInitialUpdate(),
    but it works from CFormView::OninitialUpdate()...
      

  4.   

    就是一个button按钮,我将其设为一个CButton型 的变量,和一个cString型的成员变量来显示windows text,调用m_button1.setwindowtext(str)编译通过,运行非法。
      

  5.   

    i think your project may be wrong, i build an object,and my CView is derive from CFormView.i tested such code in my project.
    void CTestView::OnInitialUpdate()
    {
    CFormView::OnInitialUpdate();
    GetParentFrame()->RecalcLayout();
    ResizeParentToFit();
    CString str="1111111111";
    m_Button.SetWindowText(str);}
      

  6.   

    my string is a member var of view-class . i initialized it in the CWinApp().
      

  7.   

    你的那个str是什么东西???
      

  8.   

    不能这样,可以直接只生成一个CButton的成员变量string,在构造函数中把那个字符串更改就可以了.