现在的位置: 首页 > 综合 > 正文

MFC应用程序如何让窗口居中显示

2018年05月28日 ⁄ 综合 ⁄ 共 280字 ⁄ 字号 评论关闭

以下两种方法可任选其一:
①在应用程序类(CxxxApp)的 InitInstance() 函数中加入:

m_pMainWnd->CenterWindow( GetDesktopWindow() );

②在主框架类(MainFrm.cpp)的OnCreate()函数中加入:

CenterWindow( GetDesktopWindow() );

Example(3): Center Window(CWnd:: GetDesktopWindow( ));

//Relative to Application's MainWindow

AfxGetMainWnd( ) -> Center Window( );

【上篇】
【下篇】

抱歉!评论已关闭.