Click here to Skip to main content
13,834,215 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 12 Dec 2018
Licenced CPOL

MFC CSplitterEx with Hide/Show Rows/Columns Ability

, 12 Dec 2018
Rate this:
Please Sign up or sign in to vote.
Extended CSplitterWnd class


Standard vanilla MFC CSplitterWnd class lacks one very important and useful feature — to hide and then to show arbitrary columns or rows.

This here is an extended MFC CSplitterWnd class with such ability. It's implemented in the form of four additional methods:

bool HideRow(UINT nRow);
bool ShowRow(UINT nRow);
bool HideCol(UINT nCol);
bool ShowCol(UINT nCol);

Class also provides functionality for working with nested splitters with the CSplitterEx::AddNested member function.


  1. Add SplitterEx.h and SplitterEx.cpp in your existing project.
  2. Add #include "SplitterEx.h"

Usage With Nested Splitters

So far, the usage is simple:

CSplitterEx mainSpl, leftSpl, rightSpl;                    
mainSpl.CreateStatic(this, 2, 1);    
leftSpl.CreateStatic(&mainSpl, 1, 2, dwStyle, mainSpl.IdFromRowCol(0, 0));
rightSpl.CreateStatic(&mainSpl, 1, 2, dwStyle, mainSpl.IdFromRowCol(1, 0));
mainSpl.AddNested(0, 0, &leftSpl); 
mainSpl.AddNested(1, 0, &rightSpl);

In the example above, we created one main splitter with two rows and one column. Then we created two additional splitters, one inside each row of the main splitter. And then, we called CSplitterEx::AddNested method, of the main splitter, to add window pointer of the nested splitters for each row respectively. This method is needed for Hide/Show methods to work properly, because our mainSpl doesn't know what «windows» dwell inside its rows/cols. We did never invoke CSplitterEx::CreateView on mainSpl as opposed to rightSpl and leftSpl.

Licensing and Contribution

You can use this code for free wherever you want. The only condition is to provide the link back to Author in the form of:


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Russian Federation Russian Federation
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionAre you sure you are the first to implement Hide/Show features? Pin
Victor Nijegorodov19-Jan-19 9:34
memberVictor Nijegorodov19-Jan-19 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web05 | 2.8.190114.1 | Last Updated 12 Dec 2018
Article Copyright 2018 by Jovibor
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid