设计了一个基于窗口的应用程序,其中会出现一个自定义的对话框,但其默认位置出现在左上角,如何才能将对话框的位置设置成居中呢,进一步求教,如何将对话框设置到任意指定位置呢?

解决方案 »

  1.   

    使用CWnd::SetWindowPos();
    具体试用方法msdn上面都有
      

  2.   

    如何将窗口居中显示?
            Easy, Call Function CWnd:: Center Windows         Example(1):  Center Window( );  //Relative to it's parent
              // Relative to Screen
             Example(2):  Center Window(CWnd:: GetDesktopWindow( ));
              //Relative to Application's MainWindow
             AfxGetMainWnd( ) -> Center Window( );
      

  3.   

    同意可可猫的,当然,如果,你建立的是基于对话框的MFC工程,可以直接在对话框的属性设置里更改此项Center属性为TRUE最为省事。