为 "desktop" child window 禁用透明度
Disable transparency for a "desktop" child window
我将 window 固定到桌面,方法是将其设为 WorkerW window 的 child,其中包含 Windows 7 Aero 中的桌面 FolderView。到目前为止,这对于将 window 固定到桌面非常有效,但是 window 具有某种透明性,这是最上面的 window.Instead of a dark background RGB(0,21,32) the actual desktop background/wallpaper shines through
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &cr);
SelectObject(hdc, GetStockObject(DC_BRUSH));
SetDCBrushColor(hdc, RGB(0,21,32));
FillRect(hdc, &cr, (HBRUSH) GetStockObject(DC_BRUSH));
客户区是通过 GDI 绘制的,我尽我所能使 window 完全不透明:SetBkColor、SetLayeredWindowAttributes、WNDCLASSEX.style = CS_PARENTDC,使用 RGBA 颜色(只能使透明度达到 100%,但将其设置为不透明不会改变结果)
有什么方法可以把不透明的window画成Aero桌面的child吗?
使用 Direct2D 可以按预期完成工作(100% 不透明),只要我将它与 GDI(CreateDCRenderTarget 或 ID2D1GdiInteropRenderTarget)混合,整个透明度问题就会再次出现。 "Direct2D and GDI Interoperability" 这么多
猜猜是时候将遗留的 GDI 代码移植到 Direct2D 然后....
我将 window 固定到桌面,方法是将其设为 WorkerW window 的 child,其中包含 Windows 7 Aero 中的桌面 FolderView。到目前为止,这对于将 window 固定到桌面非常有效,但是 window 具有某种透明性,这是最上面的 window.Instead of a dark background RGB(0,21,32) the actual desktop background/wallpaper shines through
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
GetClientRect(hWnd, &cr);
SelectObject(hdc, GetStockObject(DC_BRUSH));
SetDCBrushColor(hdc, RGB(0,21,32));
FillRect(hdc, &cr, (HBRUSH) GetStockObject(DC_BRUSH));
客户区是通过 GDI 绘制的,我尽我所能使 window 完全不透明:SetBkColor、SetLayeredWindowAttributes、WNDCLASSEX.style = CS_PARENTDC,使用 RGBA 颜色(只能使透明度达到 100%,但将其设置为不透明不会改变结果)
有什么方法可以把不透明的window画成Aero桌面的child吗?
使用 Direct2D 可以按预期完成工作(100% 不透明),只要我将它与 GDI(CreateDCRenderTarget 或 ID2D1GdiInteropRenderTarget)混合,整个透明度问题就会再次出现。 "Direct2D and GDI Interoperability" 这么多 猜猜是时候将遗留的 GDI 代码移植到 Direct2D 然后....