Pergunta

Este deve ser simples:

Eu tenho um cdialog com 2 botões. A caixa de diálogo é sempre aberta em tela cheia (sem barra de título status, etc ...) usando m_pMainWnd->ShowWindow(SW_MAXIMIZE);

Eu quero que meus botões estacem para a borda da tela.

Não há redimensionamento nem nada.

Foi útil?

Solução

Você conhece a largura da caixa de diálogo (getClientRect). Você conhece a largura dos botões.

Supondo que você esteja estalando na borda direita ...

Dentro do seu cdialog :: oncize:

 // Grab the CDialog's rect.
 CRect winRect;
 GetClientRect( &winRect );

 // Grab the button's rect.
 CRect buttonRect;
 button.GetClientRect( &buttonRect );

 // Now we need to set the top, left of the button to the right edge - the button width.
 // The y position will remain the same.
 button.SetWindowPos( NULL, winRect.right - buttonRect.Width(), buttonRect.top, 0, 0, SWP_NOZORDER | SWP_NOMOVE );
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top