以前碰到类似问题,后来也没管,有可能是操作系统bug. 你看看这个对你有没有用吧:http://msdn.microsoft.com/en-us/library/aa970688(v=vs.110).aspx•If your application is running on Microsoft Windows XP, layered windows on top of DirectX surfaces flicker when the DirectX application renders. (The actual rendering sequence is that Microsoft Windows Graphics Device Interface (GDI) hides the layered window, then DirectX draws, and then Microsoft Windows Graphics Device Interface (GDI) puts the layered window back). Non-WPF layered windows also have this limitation.
透明窗口用的是
SetLayeredWindowAttributes(RGB(255,255,0),120,1);
。
m_bkBrush.CreateSolidBrush(RGB(255,255,0));在OnCtlColor中返回m_bkBrush
oneraserbkgnd消息函数直接返回true可以避免闪烁