これは単純なものでなければなりません:
2 つのボタンを持つ CDialog があります。ダイアログは常にフルスクリーンで開かれます(タイトルバー\ステータスなどはありません...)。m_pMainWnd->ShowWindow(SW_MAXIMIZE);
ボタンを画面の端にスナップさせたい。
サイズ直し等は一切ありません。
ダイアログの幅はわかっています (GetClientRect)。ボタンの幅がわかります。
右端にスナップしていると仮定すると...
CDialog::OnSize 内:
// 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 );