Our application creates an overlay window for a custom form using the SetWindowRgn() API in its OnPaint() function. This area window has only a client area. It also has an owner window, which is a regular rectangular window.
We noticed that sometimes calling SetWindowRgn() on OnPaint() takes a long time to return if the shape of the area is complex, for example, if the area of ββthe window is text or a complex design. Even the window below this window area is slow. This happens mainly when resizing the view. We found that OnNcCalcSize() is called from within SetWindowRgn() , and the default processing of OnNcCalcSize() takes a long time to return. In addition, on some machines, the picture of the window under the window of the area is very slow.
Why does rendering a region box get slow for complex shapes? Can we do this faster by customizing event handling such as OnNcCalcSize() or other events?
NOTE. Please do not suggest using a layered window, because the technical limitation has forced us to use the area window.
source share