view类的控件成员变量怎么初始化

转载自http://liouwei20051000285.blog.163.com/blog/static/2523674200911535253736/

在OnCreat()中创建控件
在OnInitUpdate()中初始化控件
    
  int   CYourView::OnCreate(LPCREATESTRUCT   lpCreateStruct)     
  {   
      if   (CFormView::OnCreate(lpCreateStruct)   ==   -1)   
          return   -1;   
    
      //   TODO:   Add   your   specialized   creation   code   here   
      myButton.Create("abc",WS_CHILD|WS_VISIBLE,   
          CRect(23,203,160,265),this,ID_MYBUTTON);   
      return   0;   
  }   
    
  void   CYourView::OnInitialUpdate()   
  {   
      CFormView::OnInitialUpdate();   
      //   TODO:   Add   your   specialized   code   here   and/or   call   the   base   class   
      CString   str="Your   string";   
      myButton.SetWindowText(str);   
  }   
posted @ 2013-01-12 18:23  yurius  阅读(616)  评论(0编辑  收藏  举报