user9778277
user9778277

Reputation: 163

MFC CFrameWndEx sizing control to fit client area covers toolbars and status bar

I have custom FrameWnd class that has toolbars and a statusbar, but also has a child window that fills the entire client area. When I call GetClientArea and resize the child window to fill the client area, it covers the toolbars and statusbar. How can I get the size of the client area MINUS these bars

Upvotes: 0

Views: 170

Answers (1)

SoronelHaetir
SoronelHaetir

Reputation: 15162

Toolbars and the status bar occupy client area space, not non-client space, you have to obtain their sizes and subtract them yourself, windows won't do it for you.

For example:

CRect rc, rcToolbar, rcStatus;
GetClientRect(&rc);
m_Toolbar.GetClientRect(&rcToolbar);
m_Status.GetClientRect(&rcStatus);

rc.top = rcToolbar.bottom;
rc.bottom -= rcStatus.bottom;

Upvotes: 1

Related Questions