This control is necessary for the partition of the dialog, main or child window of your program by several parts. You can appropriate to each part the window, which
SplitterCtrl will manage. As a result we will get a matrix with the controls. The
SplitterCtrl is derived from
CWnd and is a common control based on MFC. Generally,
SplitterCtrl is similar to
CSplitterWnd, but it is easier to use. For example, you can create a complex matrix. For this into one or several cells it is necessary to put the same
SplitterCtrl and also to divide on parts.
The control can use scaling sizes of cells with changes in its sizes. In this case the binding of a matrix to one of four angles of the parental window is possible. Also, you can use a mouse for the dynamic or static pulling of boundaries between the windows and much more.
Using the Code
The control includes four classes:
|Class ||Description |
Base class. Includes all the base functionality, but it does not draw itself.
SplitterCtrlBase. Also it is derived from
SplitterCtrlDraw classes for the correction of sizes of parts and to draw the control respectively.
This class makes it possible to assign sizes of parts of the control. For using be inherited from
ISplitterCtrlRecalc and realize its functions. Also in constructor of your class it is necessary to call the
SetRecalcManager function with pointer of
This class makes it possible to draw the control. You can draw your window yourself. For this be inherited from
SplitterCtrlDraw and realize its functions. Also in constructor of your class it is necessary to call the
SetDrawManager function with pointer of
To create the control and add elements to it, do the following:
#include <span class="code-string">"SplitterCtrl.h"</span>
CListCtrl m_List1, m_List2;
WS_CHILD | WS_VISIBLE,CRect(0,0,200,200),
return -1; .
if(m_List1.Create(WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | LVS_REPORT,CRect(0,0,0,0),
m_List2.Create(WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | LVS_REPORT,CRect(0,0,0,0),
return -1; .
You can manage the control as a normal matrix, dynamically insert and delete rows and columns (
DeleteColumn). The control makes it possible to assign the sizes (
SetHeightForDynamic), and also to equalize widths and heights of the cells (
SetEqualHeightRows). The control is expected to call the
Update function to show the results that are set by functions
The control is able to save and load its state from the registry or other sources (
SaveState). This is one of the possibilities. To get the full power, look at the opened interface of the
Good luck :-)