Using a layered window can significantly improve performance and visual effects for a window that has a complex shape, animates its shape, or wishes to use alpha blending effects. The system automatically composes and repaints layered windows and the windows of underlying applications. As a result, layered windows are rendered smoothly, without the flickering typical of complex window regions. In addition, layered windows can be partially translucent, that is, alpha-blended.
To create a layered window, specify the WS_EX_LAYERED extended window style when calling the CreateWindowEx function, or call the SetWindowLong function to set WS_EX_LAYERED after the window has been created. After the CreateWindowEx call, the layered window will not become visible until the SetLayeredWindowAttributes or UpdateLayeredWindow function has been called for this window. Note that WS_EX_LAYERED cannot be used for child windows.
创建层叠窗口时需要注意:
Layered属性只能附加给父窗口,换一个说法就是窗口类型是WS_POPUP或者WS_EX_OVERLAPPEDWINDOW。
设定属性后,如果使用SetLayeredWindowAttributes 则父窗口可以有子窗口并且子窗口和父窗口拥有相同的Layered属性,窗口子控件的绘制使用默认方式,也就是不需要人为控制。
如果使用UpdateLayeredWindow,则只能手工绘制所有窗口。
本文介绍了层叠窗口技术,该技术能显著提升复杂形状窗口的性能与视觉效果,特别是对于那些需要透明混合效果的窗口。文章详细解释了如何通过设置WS_EX_LAYERED样式来创建层叠窗口,并探讨了使用SetLayeredWindowAttributes与UpdateLayeredWindow函数的不同影响。

被折叠的 条评论
为什么被折叠?



