CWindow::CenterWindow

Vengono illustrati la finestra a una finestra specifica.

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

Parametri

  • hWndCenter
    [in] handle della finestra in cui il centro.Se questo parametro è NULL (valore predefinito), il metodo viene impostata hWndCenter alla finestra padre della finestra se è una finestra figlio.In caso contrario, imposterà hWndCenter alla finestra proprietaria della finestra.

Valore restituito

TRUE se la finestra è allineata correttamente; in caso contrario, FALSE.

Esempio

//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

Requisiti

Header: atlwin.h

Vedere anche

Riferimenti

Classe di CWindow

CWindow::MoveWindow

CWindow::SetWindowPos