这是我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,它是一个工具栏: