Click here to Skip to main content
15,885,192 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello CP users,
I want to override CSplitterWnd
Here is what I did:
C++
class CMySplitter : public CSplitterWnd
{
public:
	CMySplitter()
	{
		m_cxSplitter = m_cySplitter = 4;
		m_cxBorderShare = m_cyBorderShare = 0;
		m_cxSplitterGap = m_cySplitterGap = 4;
		m_cxBorder = m_cyBorder = 2;
	}
};


I have did many testing manipulating these member variables, & I found that:
m_cxSplitter should be >= (m_cxBorder * 2)
&
m_cySplitter should be >= (m_cyBorder * 2)
Or-else the application will crash when the user try to resize the splitter window.
I am really confused why is this !
And the main frame border rectangle of the splitter window will not be painted correctly (Invalidated) if the m_cxBorder > 2 or m_cyBorder > 2

Can any body help me to make this last repaint correctly when the user try to resize the splitter window.

Thank you for your understanding.
Posted
Comments
JackDingler 25-Jun-13 16:03pm    
Don't use values that cause crashes or produce painting artifacts.

If you want to use values that the Microsoft Developers didn't write supporting code for, then you may have to enhance the CSplitterWnd class. Microsoft provides source code for the MFC library so that you may create your own custom versions of the MFC classes.
The_Inventor 26-Jun-13 5:33am    
Make it a variable within the WM_RESIZE message handler. Then you can make the splitter any size you want, and it will resize correctly. Oh, and m_cxBorderShare = m_cyBorderShare = 2;
Jonathan Davies 26-Jun-13 6:04am    
Presumably the m_cxSplitter includes the width of the borders and as you have 1 border on each side it has to be at least equal to m_cxBorder x 2. Same for Y.
Mr. Tomay 27-Jun-13 13:00pm    
Good thinking

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900