Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VC6 C++ MFC
Hello CP users,
I want to override CSplitterWnd
Here is what I did:
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 25-Jun-13 9:55am
tomay30001.2K
Comments
JackDingler at 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 at 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 at 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.
tomay3000 at 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)

  Print Answers RSS
0 OriginalGriff 515
1 Maciej Los 290
2 Richard MacCutchan 265
3 BillWoodruff 235
4 Suraj Sahoo | Coding Passion 175
0 OriginalGriff 8,804
1 Sergey Alexandrovich Kryukov 7,457
2 DamithSL 5,689
3 Maciej Los 5,279
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411028.1 | Last Updated 25 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100