Layered Windows:层叠窗口

Layered Windows

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,则只能手工绘制所有窗口。

你可能感兴趣的:(windows,function,System,performance)