文档/视图下主窗口屏幕居中
在CWinApp类的InitInstance()中添加如下代码
RECT rc;
::GetWindowRect( m_pMainWnd->m_hWnd, &rc );
::SetWindowPos( m_pMainWnd->m_hWnd, HWND_TOP,
( GetSystemMetrics( SM_CXSCREEN ) - ( rc.right - rc.left ) ) / 2,
( GetSystemMetrics( SM_CYSCREEN ) - ( rc.bottom - rc.top ) ) / 2,
rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW );

浙公网安备 33010602011771号