Overlapping Controls Are Not Supported by Windows

Last reviewed: November 2, 1995
Article ID: Q79981
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) versions 3.1
  • Microsoft Win32 Application Programming Interface (API) included with:

        - Microsoft Windows NT versions 3.5 and 3.51
        - Microsoft Windows 95 version 4.0
    

SUMMARY

Child window controls should not be overlapped in applications for the Windows operating system. When one control overlaps another control, or another child window, the borders shared by the controls may not be drawn properly. Overlapping controls may confuse the user of the application because clicking the mouse in the common area may not activate the control that the user intended to activate. This behavior is a consequence of the way that Windows is designed.

MORE INFORMATION

The following example illustrates the painting problems caused by the ambiguity of overlapping borders. Consider three edit controls, called A, B and C, which overlap each other, and an enclosing child window D:

     ____________________________________________
     | | A          | B          | C          | |
     | ---------------------------------------- |
     |                 D                        |
     --------------------------------------------

Assume that control B has the focus. If this set of controls is covered by another window, which is subsequently moved away, Windows will send a series of client and nonclient messages to each of the controls and to the enclosing child window. The result of these messages may appear as the illustration below, where the portion of window B's border that overlapped with part of window D's border is missing:

     _______________             ________________
     | | A          | B          | C          | |
     | ---------------------------------------- |
     |                 D                        |
     --------------------------------------------

Repainting problems related to overlapping controls may vary depending on the version of Windows used.


Additional reference words: 3.00 3.10 3.50 3.51 4.00 95 CS_PARENTDC
WS_CLIPCHILDREN
WS_CLIPSIBLINGS WM_NCPAINT WM_PAINT
KBCategory: kbui
KBSubcategory: UsrDlgs


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.