これは、OnSize
プロパティ シートのサイズを変更するための私の方法です。
void CResizingMFCPropertySheet::OnSize(UINT nType, int cx, int cy)
{
CMFCPropertySheet::OnSize(nType, cx, cy);
if (!GetActivePage()) return;
if (!GetTabControl()) return;
if (nType == SIZE_MINIMIZED)
return;
int dx = cx - save_rc.Width();
int dy = cy - save_rc.Height();
int count = 0;
for (CWnd *child = GetWindow(GW_CHILD); child; child = child->GetWindow(GW_HWNDNEXT))
count++;
HDWP hDWP = ::BeginDeferWindowPos(count);
for (CWnd *child = GetWindow(GW_CHILD); child; child = child->GetWindow(GW_HWNDNEXT))
{
bool move = false;
//If you add child controls manually, you want to move not resize
if(child == &m_lblResize && m_lblResize.GetSafeHwnd() != nullptr)
move = true;
CRect r;
child->GetWindowRect(&r);
ScreenToClient(&r);
if (move || child->SendMessage(WM_GETDLGCODE) & DLGC_BUTTON)
{
//move the main buttons and the child controls
r.left += dx;
r.top += dy;
::DeferWindowPos(hDWP, child->m_hWnd, 0, r.left, r.top, 0, 0,
SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
}
else
{
//this must be a child window, resize it
r.right += dx;
r.bottom += dy;
::DeferWindowPos(hDWP, child->m_hWnd, 0, 0, 0, r.Width(), r.Height(),
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
}
}
::EndDeferWindowPos(hDWP);
GetClientRect(&save_rc);
Invalidate(TRUE);
}
ただし、プロパティ シートのルック アンド フィールを次のように変更すると、次のようになります。
SetIconsList(IDB_MAINT_DB_LARGE, 32);
SetLook(CMFCPropertySheet::PropSheetLook_OutlookBar);
次に、プロパティ シートのサイズを変更します。
OnSize
Outlook バーの幅をそのままにしておくにはどうすればよいでしょうか? 高さのサイズを変更するだけです。
この質問と関連する回答がありますが、Microsoft サポート技術情報の記事への回答のリンクが機能していません。いずれにしても、正しくOnSize
レンダリングするにはカスタマイズする必要があります。PropSheetLook_OutlookBar
何とかして ...
アップデート
Spy によると、それはツールバーです。