Share via


When to use WS_CLIPCHILDREN and WS_CLIPSIBILINGS styles?

Question

Tuesday, June 26, 2018 8:49 AM

Hi,

When I have to set WS_CLIPCHILDREN and WS_CLIPSIBILINGS styles for a dialog?

To resolve the issue in this link, https://social.msdn.microsoft.com/Forums/vstudio/en-US/72702947-a25b-4b18-ad37-46fcdb060b8e/using-ceditctrl-in-cmfctabctrl?forum=vcgeneral, I set WS_CLIPCHILDREN but I dont have clear understanding on these styles.

Thanks.

All replies (1)

Tuesday, June 26, 2018 9:14 AM âś…Answered

From MSDN :

Clipping

The system does not automatically clip a child window from the parent window's client area. This means the parent window draws over the child window if it carries out any drawing in the same location as the child window. However, the system does clip the child window from the parent window's client area if the parent window has the WS_CLIPCHILDREN style. If the child window is clipped, the parent window cannot draw over it.

A child window can overlap other child windows in the same client area. A child window that shares the same parent window as one or more other child windows is called a sibling window. Sibling windows can draw in each other's client area, unless one of the child windows has the WS_CLIPSIBLINGS style. If a child window does have this style, any portion of its sibling window that lies within the child window is clipped.

If a window has either the WS_CLIPCHILDREN or WS_CLIPSIBLINGS style, a slight loss in performance occurs. Each window takes up system resources, so an application should not use child windows indiscriminately. For best performance, an application that needs to logically divide its main window should do so in the window procedure of the main window rather than by using child windows.