简单的SDI程序,自己做的一些菜单操作,但每次启动程序发现位置不固定。应该在哪控制可以使SDI启动时位置固定。知道的解答下。在线等啊

解决方案 »

  1.   

    MainFrame里边,OnCreate里,调用
    CenterWindow,让窗口居中
    或者MoveWindow,或者SetWindowPos,设置窗口到你指定的位置、大小
      

  2.   


    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    cs.x = 100;
    cs.y = 100;
    if( !CFrameWnd::PreCreateWindow(cs) )
    return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs return TRUE;
    }
      

  3.   


    BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
    {
    cs.x = 100; // 指定位置
    cs.y = 100;
             // cs.cx, cs.cy 指定大小
    if( !CFrameWnd::PreCreateWindow(cs) )
    return FALSE;
    // TODO: Modify the Window class or styles here by modifying
    //  the CREATESTRUCT cs return TRUE;
    }