Showing Window Contents While Resizing the Splitter
Environment: Visual C++
The CSplitterWnd class of MFC does not draw panes while resizing. My class allows you to show a window's contents while you are resizing the splitter pane. It supports only one row and two columns per splitter window now, but you can contribute additional code and develop it.
The CSplitterWnd class does not handle WM_SIZING because the window itself does not resize -- neither do child windows -- because the splitter does not notify them until the sizing finishes. I have used the WM_MOUSEMOVE handler with the MK_LBUTTON flag; this means that the user is dragging the splitter bar while moving the mouse. I have overriden the base class' handler and put in my code to resize and paint panes while the user is dragging. I have also used two values to handle drag's start coordinates; you may use it as POINT or CPoint, instead of two variables.
class CMySplitter : public CSplitterWnd
{
public:
CMySplitter();
virtual ~CMySplitter();
// Overrides
// ClassWizard generated virtual function overrides
// {{AFX_VIRTUAL(CMySplitter)
// }}AFX_VIRTUAL
protected:
int moveX; // move start X
int moveY; // move start Y
afx_msg void OnMouseMove(UINT nFlags, CPoint pt);
afx_msg void OnLButtonDown(UINT nFlags, CPoint pt);
DECLARE_MESSAGE_MAP()
};
In implementation:
void CMySplitter::OnLButtonDown(UINT nFlags, CPoint pt)
{
moveX=pt.x; // move start X position
moveY=pt.y; // move start Y position
CSplitterWnd::OnLButtonDown(nFlags, pt);
}
void CMySplitter::OnMouseMove(UINT nFlags, CPoint pt)
{
if (nFlags==MK_LBUTTON) // Left button pressed
{
static int resized=0; // we will check if pane is resizing
if (!resized)
{
int cxCur=0, cxMin=0;
GetColumnInfo(0,cxCur, cxMin); // Get col's size before resizing
if (moveY!=pt.y) // If mouse moved vertically
moveY=pt.y; // discard it
if (pt.y==moveY) // Are we ready to resize?
{
if (pt.x<moveX) // if pane 0 is resizing to the left side
// i.e. getting smaller
{
if (cxCur+(pt.x<moveX?pt.x-moveX:1)>=0)
// will new size be greater than, or equal to, 0?
{
SetColumnInfo(0,cxCur+(pt.x<moveX?pt.x-moveX:1),cxMin);
// set it
moveX=pt.x; // set move start point to current position
}
}
if (pt.x>moveX) // if pane 0 is resizing to the right side
// i.e. getting larger
{
if (cxCur+(pt.x>moveX?pt.x-moveX:-1)>=0)
// check for new size, again
{
SetColumnInfo(0,cxCur+(pt.x>moveX?pt.x-moveX:-1), cxMin);
// set it
moveX=pt.x; // set move start point to current position
}
}
}
else
if (pt.x!=moveX) // hmm. mouse moved in vertical
moveY=pt.y; // anyway, set it to current Y coordinate
RecalcLayout(); // recalculate pane sizes, and redraw
GetColumnInfo(0,cxCur, cxMin); // get pane info
moveX=cxCur; // set current start position to pane's width
resized=1; // yes, we are resized
return;
}
if (resized) // we have resized pane
resized=0; // reset to resize in next time
}
CSplitterWnd::OnMouseMove(nFlags, pt);
// if not leftbutton down, do the default thing.
}
Add this class into your project and create the splitter as you were creating it before.
There might be programming errors on the preceding code. I wrote it hurriedly because I need it. I run the code without any exceptions.
I am open for suggestions and corrections. Please feel free to write.
Downloads
Download demo project - 35 KbDownload source - 42 Kb

Comments
Something that other people does when dealing with nike and furthermore those things youshould do completely different.
Posted by icoppyapedcap on 04/23/2013 07:59pmUbvGmiDjaMss[url=http://www.guccisayihujp.biz/]ã°ãã ããã°[/url]KyaCpzPloMjq [url=http://www.guccisayihujp.biz/ãã°ãããã¬ãã£ã¼ã¹è²¡å¸-c-5.html]ã°ããããã¼ã±ã¼ã¹[/url]QfxAqzRcrYus [url=http://www.guccisayihujp.biz/ãã°ãããã¬ãã£ã¼ã¹é·è²¡å¸-c-6.html]ã°ãã è²¡å¸ æ°ä½[/url]TawFpxHnpHgk [url=http://www.guccisayihujp.biz/ãã°ãããã·ã§ã«ãã¼ããã°-c-2.html]gucci ã¢ã¦ãã¬ãã[/url]TcsXbmWqsRvt IkrPwvJxrFwf [url=http://www.adidasgekiyasu.biz/]adidas originals[/url]HfxSnpDtqNor [url=http://www.nikegekiyasu.biz/]ãã¤ã[/url]SinQmnTrcLao AnlAirAdySui [url=http://www.chanelsayihujp.biz/]chanel[/url] WbvZppGqvExv [url=http://www.chanelsayihujp.biz/ã·ã£ãã«è²¡å¸-c-9.html]chanel 財å¸[/url]NfsJgzIupHme [url=http://www.chanelsayihujp.biz/ã·ã£ãã«-ã·ã§ã«ãã¼ããã°-c-1.html]ã·ã£ãã« ããã©ãã»[/url]HejMcgVzmQyg EusWutFzeXyx [url=http://www.chloesayihujp.biz/]ã¯ã㨠財å¸[/url] UhkNiqWyyOcl [url=http://www.chloesayihujp.biz/ã¯ãã¨-é·è²¡å¸-c-3.html]ã¯ã㨠é·è²¡å¸[/url] TndPzlUmrXmm [url=http://www.chloesayihujp.biz/ã¯ãã¨-ãã³ãããã°-c-2.html]chloe ããã°[/url] VloBloPmcAsp
Replyhttp://www.codeguru.com/dialog/splitterdemo.exe is absent
Posted by Legacy on 06/13/2002 12:00amOriginally posted by: Alexi Jordanov
http://www.codeguru.com/dialog/splitterdemo.exe is absent
Regards, Alex
Reply