SetLayeredWindowAttributes不工作在Windows 7 [英] SetLayeredWindowAttributes not working on Windows 7

查看:521
本文介绍了SetLayeredWindowAttributes不工作在Windows 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用SetLayeredWindowAttributer使一个特定颜色的分层窗口透明。

I am using SetLayeredWindowAttributer to make a particular color of layered window transparent.

这在Windows XP,VISTA上可以正常工作。但是当我在Windows 7上使用相同的它不工作。

This works fine on Windows XP,VISTA . But when I use the same on Windows 7 its not working.

SetLayeredWindowAttributes(hWnd, RGB(0xff,0xff,0xff), 0, LWA_COLORKEY);

当我使用LWA_ALPHA时,它也工作。
问题是我不能在Windows 7中使特定的颜色透明。

When I use LWA_ALPHA then also it works. Problem is that I am not able to make a particular color transparent in Windows 7.

以下语句适用于Windows 7

The following statement works on Windows 7

SetLayeredWindowAttributes(hWnd,RGB(0xff,0xff,0xff), 100, LWA_ALPHA);

渲染的颜色值是否可能与SetLayeredWindowAttributes中的颜色值不匹配?

Is it possible that the rendered color values not matching the color value in SetLayeredWindowAttributes?

推荐答案

您应该避免使用LWA_COLORKEY使用0xff,0xff,0xff(white)。任何其他值应该很好(例如0xff,0xff,0xfe)。

You should avoid using 0xff,0xff,0xff (white) with LWA_COLORKEY. Any other value should be fine (e.g. 0xff,0xff,0xfe).

为了更好地控制你的分层窗口,我建议你考虑使用UpdateLayeredWindowIndirect。我写了一篇文章,详细描述了如何将它与GDI和Direct2D一起使用。

For more control over your layered window I suggest you consider using UpdateLayeredWindowIndirect. I wrote an article that describes in detail how it can be used with both GDI and Direct2D.

http://msdn.microsoft.com/en-us/magazine/ee819134.aspx

这篇关于SetLayeredWindowAttributes不工作在Windows 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆