WS

xiaoxiao2021-02-28  75

WS_CLIPCHILDREN

裁剪子窗口区域

MSDN解释

Excludes the area occupied by child windows when drawing occurs within the parent window. This style is used when creating the parent window. 当父窗口需要绘制的时候,排除其子窗口覆盖的部分,这个属性用于父窗口创建的时候。 通俗的讲,就是当父窗口需要重绘的时候,(裁剪掉)不会去绘制子窗口覆盖的部分,留给子窗口自己去绘制。

WS_CLIPSIBLINGS

裁剪兄弟

MSDN解释

Clips child windows relative to each other; that is, when a particular child window receives a WM_PAINT message, the WS_CLIPSIBLINGS style clips all other overlapping child windows out of the region of the child window to be updated. If WS_CLIPSIBLINGS is not specified and child windows overlap, it is possible, when drawing within the client area of a child window, to draw within the client area of a neighboring child window. 剪辑子窗口相对于其他窗口;也就是说,当一个特定的子窗口接收到WM_PAINT消息时, WS_CLIPSIBLINGS样式将所有其他重叠子窗口从子窗口的区域中剪切出来,以更新。如果没有指定 WS_CLIPSIBLINGS,当子窗口重叠时,在子窗口的客户区域内绘制时,可以在相邻子窗口的客户区域内绘制。 通俗的讲,兄弟窗口之间重叠的时候,指定 WS_CLIPSIBLINGS 属性的窗口在绘制的时候会裁剪出重叠的区域,也就是不绘制重叠区域。

补充说明

1. WS_CLIPCHILDREN和WS_CLIPSIBLING都是为了减少重画,减少闪动,保证窗口的重叠部分只有一个窗口来实现PAINT。 2. 可用如下代码修改窗口属性 LONG style = GetWindowLong(GetDlgItem(IDC_STATIC_VIDEO_MAIN)->GetSafeHwnd(),GWL_STYLE); style = style | WS_CLIPSIBLINGS ; SetWindowLong(GetDlgItem(IDC_STATIC_VIDEO_MAIN)->GetSafeHwnd(),GWL_STYLE,style); 3. WS_CLIPSIBLINGS实际上还需要和控件的叠放顺序(z order)配合使用,才能看出明显的效果 4. 所有的overlapped和popup风格的窗口,都有WS_CLIPSIBLINGS 属性。也就是说这类风格的窗口,你是去不掉WS_CLIPSIBLINGS 属性的,不会在它重叠的兄弟窗口绘图;
转载请注明原文地址: https://www.6miu.com/read-81317.html

最新回复(0)