我用的是新建对话框资源的方法问题是我设置好了,但是启动画面都是在屏幕的左侧显示,调用什么函数能让我的启动画面在屏幕中央显示????

解决方案 »

  1.   

    CWnd::CenterWindow
    void CenterWindow( CWnd* pAlternateOwner = NULL );ParameterspAlternateOwnerPointer to an alternate window relative to which it will be centered (other than the parent window).ResCenters a window relative to its parent. Usually called from CDialog::OnInitDialog to center dialog boxes relative to the main window of the application. By default, the function centers child windows relative to their parent window, and pop-up windows relative to their owner. If the pop-up window is not owned, it is centered relative to the screen. To center a window relative to a specific window which is not the owner or parent, the pAlternateOwner parameter may be set to a valid window. To force centering relative to the screen, pass the value returned by CWnd::GetDesktopWindow as pAlternateOwner.ExampleBOOL CAboutDlg::OnInitDialog() 
    {
       CDialog::OnInitDialog();
       
       CenterWindow();
       return TRUE;
    }
      

  2.   

    资源中设置对话框的 x 和 y pos