Repositioning of MFCToolBars

113 views Asked by At

I am using Visual Studio 2019, I created an MDI application.

I have placed 4 toolbars in a row in CMainFrame (derived from CMDIFrameWndEx). Depending on the active view I hide one toolbar, and thus it’s possible have a gap between two toolbars. How can I close the gap automatically by attaching the right toolbar to the left?

Here is my code:

LRESULT CMainFrame::OnActivateViewSelect(WPARAM w, LPARAM l)
{
    if (m_bViewInit)
    {
        auto iViewSelect = _S32(w);
        if (iViewSelect != m_lastpane)
        {
            m_lastpane = iViewSelect;
            ShowPane(&m_wndToolBar[0], iViewSelect == 0, FALSE, iViewSelect == 0);
            ShowPane(&m_wndToolBar[1], iViewSelect == 1, FALSE, iViewSelect == 1);
            ShowPane(&m_wndToolBar[2], iViewSelect == 2, FALSE, iViewSelect == 2);
            ShowPane(&m_wndToolBar[3], iViewSelect == 3, FALSE, iViewSelect == 3);
            RecalcLayout();
        }
    }
    return 0L;
}
0

There are 0 answers