Skip to main content.

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;
}

};

Comments

No comments yet

Add Comment

You must be logged in as a member to add comment to this blog