CMainFrame and CLayoutMgrBase<>
When your mainframe class inherit from both
CFrameWindowImpl<> and
CLayoutMgrBase<>, you need to handle the resize of the window a little bit differently than when using a standard
CWindowImpl<> class. You need to override the default
CFrameWindowImpl<>::
UpdateLayout() and
CLayoutMgrBase<>::
GetRect().
class CMainFrame :
...,
public CFrameWindowImpl<CMainFrame>,
public CLayoutMgrBase<CMainFrame>
{
...
void UpdateLayout(BOOL bResizeBars = TRUE)
{
RECT rect = { 0 };
GetClientRect(&rect);
// position bars and offset their dimensions
UpdateBarsPosition(rect, bResizeBars);
// resize client window
CLayoutMgrBase<CMainFrame>::UpdateLayout();
}
CRect GetRect()
{
RECT rect = { 0 };
GetClientRect(&rect);
// position bars and offset their dimensions
UpdateBarsPosition(rect, FALSE);
return rect;
}
};
Posted 03/22/05 by Kickaha | Filed under: Code Tips
Comments
Add Comment