我想通过程序来设置dialog(view)的大小,用movewindow设置了在运行时要报错,用create和createx重新创建窗体在运行时什么也没看见(好象是一创建出来就被销毁了)。
   该用什么方法?具体怎么实现?请各位指教

解决方案 »

  1.   

    调用CWnd: : SetWindowPos并指定SWP_NOMOVE标志, 也可调用CWnd : : MoveWindow 但必须指定窗口的位置。
    // Get the size of the window .
    Crect reWindow
    GetWindowRect (reWindow )
    //Make the window twice as wide and twice as tall .
    SetWindowPos (NULL , 0 , 0 , reWindow . Width ( ) *2,
    reWindow . Height () * 2,
     SWP_NOMOVE |SWP_NOZORDER )
      

  2.   

    movewindow的width和height又是拿来设置什么的?
    为什么create和createx重新创建窗体在运行时什么也没看见?
      

  3.   

    MoveWindow()既可以移动窗口,也可以改变窗口大小,前两个参数指明窗口左上角的位置,第三四个参数指明窗口的宽度和高度。
    Create之后要执行ShowWindow(SW_SHOW)
      

  4.   

    看看SetWindowPos函数
    它不仅可以改变窗口的大小,还可以改变窗口的位置
      

  5.   

    Yes, use MoveWindow or SetWindowPos.After Create or Createex, pls use Invalidate to repain control,
    or set the SW_SHOW parameter.For example:CMyDialog* pDialog;void CMyWnd::OnSomeAction()
    {
       //pDialog initialized to NULL in the constructor of CMyWnd class
       pDialog = new CMyDialog();
       //Check if new succeeded and we got a valid pointer to a dialog object
       if(pDialog != NULL)
       {
          BOOL ret = pDialog->Create(IDD_MYDIALOG,this);
          if(!ret)   //Create failed.
             AfxMessageBox("Error creating Dialog");
          pDialog->ShowWindow(SW_SHOW);
       }
       else
          AfxMessageBox("Error Creating Dialog Object");
    }
      

  6.   

    view类的改变了大小后(rect.right*2,rect.bottom*2,超过了clientrect),没有显示出scroll,我要求它超出clientrect后显现滚动条
    how to do it?
      

  7.   

    怎样设置scroll,让它在增大了view后显示???