CWindow::CenterWindow

창을 지정 된 창에 맞춥니다.

BOOL CenterWindow(
   HWND hWndCenter = NULL 
) throw();

매개 변수

  • hWndCenter
    [in] 가운데를 창 핸들입니다.이 매개 변수가 NULL 메서드 (기본 값) 설정 hWndCenter 창의 부모 창의 자식 창에 있는 경우에.설정 하지 않으면 hWndCenter 창의 소유자 창.

반환 값

True 이면 창 가운데 성공적으로 하는 경우. 그렇지 않으면 거짓.

예제

//The following example attaches various HWNDs to the CWindow objects 
//and calls CWindow::CenterWindow() for each of them

CWindow childWindow, popupWindow, overlappedWindow;

childWindow.Attach(hWndChild); //a window created with WS_CHILD style
childWindow.CenterWindow();    //This will center the child 
                               //window against its Parent window

popupWindow.Attach(hWndPopup); //a window created with WS_POPUP style
popupWindow.CenterWindow();    //This will center the popup window 
                               //against its Owner window

overlappedWindow.Attach(hWndOverlapped); //a window created with 
                                         //WS_OVERLAPPED style
overlappedWindow.CenterWindow(::GetDesktopWindow()); //This will center 
                       //the overlapped window against the DeskTop window

요구 사항

헤더: atlwin.h

참고 항목

참조

CWindow 클래스

CWindow::MoveWindow

CWindow::SetWindowPos