Restricting the size of a splitter pane | CodeGuru

Restricting the size of a splitter pane

I find the solution about restrict the size of the pane. First derive class XSplitterWnd from CSplitterWnd, Then handle the WM_ONSIZE,call the SetColInfo() and SetRowInfo() in OnSize function. And handle the WM_MOUSEMOVE and WM_SETCURSOR to prevent user from changing size. void XSplitterWnd::OnSize(UINT nType, int cx, int cy) { RECT rect; int Height; GetClientRect( &rect ); […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 24, 1999
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

I find the solution about restrict the size of the pane.

    First derive class XSplitterWnd from CSplitterWnd,
    Then handle the WM_ONSIZE,call the SetColInfo() and SetRowInfo() in OnSize function.
    And handle the WM_MOUSEMOVE and WM_SETCURSOR to prevent user from changing size.
void XSplitterWnd::OnSize(UINT nType, int cx, int cy)
{
 RECT        rect;
 int         Height;
 GetClientRect( &rect );
 Height = rect.bottom – rect.top – 36;
 if ( m_pRowInfo != NULL )
  if ( Height < 0 )
   SetRowInfo( 0, 1, 1);
  else
   SetRowInfo( 0, Height, Height );

 CSplitterWnd::OnSize(nType, cx, cy);

 // TODO: Add your message handler code here
}

void XSplitterWnd::OnMouseMove(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default

 //CSplitterWnd::OnMouseMove(nFlags, point);
}

void XSplitterWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default

 //CSplitterWnd::OnLButtonDown(nFlags, point);
}

BOOL XSplitterWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
 // TODO: Add your message handler code here and/or call default

 //return CSplitterWnd::OnSetCursor(pWnd, nHitTest, message);
 return FALSE;
}

Any comments and suggests, please let me know.

Regards, Sesame

Date Last Updated: March 24, 1999

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.