Exporter (0) Imprimer
Développer tout
MFC
Développer Réduire

CWnd::CenterWindow

Centers a window relative to its parent.

void CenterWindow(
   CWnd* pAlternateOwner = NULL 
);

pAlternateOwner

Pointer to an alternate window relative to which it will be centered (other than the parent window).

Usually called from CDialog::OnInitDialog to center dialog boxes relative to the main window of the application. By default, the function centers child windows relative to their parent window, and pop-up windows relative to their owner. If the pop-up window is not owned, it is centered relative to the screen. To center a window relative to a specific window which is not the owner or parent, the pAlternateOwner parameter may be set to a valid window. To force centering relative to the screen, pass the value returned by CWnd::GetDesktopWindow as pAlternateOwner.


BOOL CAboutDlg::OnInitDialog()
{
   CDialog::OnInitDialog();

   CenterWindow();

   return TRUE;
}


Header: afxwin.h

Ajouts de la communauté

AJOUTER
Microsoft réalise une enquête en ligne pour recueillir votre opinion sur le site Web de MSDN. Si vous choisissez d’y participer, cette enquête en ligne vous sera présentée lorsque vous quitterez le site Web de MSDN.

Si vous souhaitez y participer,
Afficher:
© 2015 Microsoft