Microsoft KB Archive/177341

= How To Remove the Sizing Grip from a Status Bar =

Article ID: 177341

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition

 Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition</li></ul>

 Microsoft Visual C++ 6.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q177341

<div class="summary_section">

SUMMARY
A status bar control has diagonal lines in the lower right corner, called the sizing grip, that can be used to resize the window. Occasionally, you will remove this grip to prevent the user from resizing the window.

For instance, you have removed the WS_THICKFRAME style to prevent the mainframe window from resizing. If the user moves the sizing grip and resizes the status bar, painting problems can occur.

<div class="moreinformation_section">

MORE INFORMATION
You can remove the sizing grip by deriving a class from CStatusBar and overriding PreCreateWindow to change the styles that are used. Inside of PreCreateWindow, you must also remove the SBARS_SIZEGRIP style. For example: BOOL CMyStatusbar::PreCreateWindow(CREATESTRUCT& cs) {     // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs.

cs.style &= ~SBARS_SIZEGRIP;

return CStatusBar::PreCreateWindow(cs); } You can then replace your custom CStatusBar derived class with the default.

For example, if this is the status bar in the main frame window, include the header file for your CStatusBar derived class in your Mainfrm.h file. Also, in your Mainfrm.h file, change the declaration of the status bar created in your Mainfrm.cpp file to use that class.

<div class="references_section">