Re: Splitterwnd with layout problem
"97612" <97612@discussions.microsoft.com> ha scritto nel messaggio
news:8554FA69-F4C2-492B-8ABB-44140412D8AB@microsoft.com...
I want to split the mainFrame into six regions.Bolow what I've done.
[...]
But the result is that there are only two split window showed. The 2x2
windows is hidden. I need to use mouse to resize the window's size to let
the
2x2 windows show up. Is the parameters wrong? Is the x and y wrong?
I would try to add an handler for WM_SIZE of your main frame window, and use
SetRowInfo, SetColumnInfo and RecalcLayout methods of splitter window to
properly adjust the layout, something like this:
<code>
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
CRect cr;
GetWindowRect(&cr);
if ( m_bSplitterIsReady && nType != SIZE_MINIMIZED )
{
m_wndSplitter.SetRowInfo( 0, cr.Height()/2, 0 );
m_wndSplitter.SetRowInfo( 1, cr.Height()/2, 0 );
m_wndSplitter.SetColumnInfo( 0, cr.Width(), 0 );
m_wndSplitter.RecalcLayout();
m_wndSplitter2.SetRowInfo( 0, cr.Height()/2, 0 );
m_wndSplitter2.SetColumnInfo( 0, cr.Width()/2 , 0);
m_wndSplitter2.SetColumnInfo( 1, cr.Width()/2, 0);
m_wndSplitter2.RecalcLayout();
m_wndSplitter3.SetRowInfo( 0, cr.Height()/4, 0 );
m_wndSplitter3.SetRowInfo( 1, cr.Height()/4, 0 );
m_wndSplitter3.SetColumnInfo( 0, cr.Width()/4, 0 );
m_wndSplitter3.SetColumnInfo( 1, cr.Width()/4, 0 );
m_wndSplitter3.RecalcLayout();
}
}
</code>
The 'm_bSplitterIsReady' is a boolean data member of the CMainFrame class,
that is initialized to false in the constructor, and is set to true after
the splitter windows and views are created (e.g. in
CMainFrame::OnCreateClient, after the several .CreateStatic, .CreateView
calls).
HTH,
Giovanni