Article ID: 79982 - View products that this article applies to.
This article was previously published under Q79982
3.00 3.10 WINDOWS kbprg kbprb kbcode
When a BS_GROUPBOX style window is created, its background does not erase correctly.
The parent window of the BS_GROUPBOX style window has the WS_CLIPCHILDREN style, which prevents the parent window from erasing the group box's background.
Subclass the group box window to process the WM_ERASEBKGND message by erasing its background. Listed below is a code fragment to demonstrate this procedure.
The WS_CLIPCHILDREN style causes a window to exclude the areas occupied by child windows when the window paints its client area. However, a BS_GROUPBOX style window is a static control that never erases its background. Erasing the background removes any controls or buttons that appear within the group box.
Therefore, when another child window is dropped over a group box and subsequently dragged away, portions of that child window remain visible in the group box's background. This problem does not occur when the parent window does not have the WS_CLIPCHILDREN style.
The following code fragment should be placed in the group box's subclass procedure. This code erases the background of the group box.
Article ID: 79982 - Last Review: February 11, 2005 - Revision: 1.1
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Contact us for more help