ccbuluo / duilib

Automatically exported from code.google.com/p/duilib
0 stars 0 forks source link

透明窗体的bug #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. 创建一个窗体,设置bktrans属性。
2. 贴上png透明异形图片,首次出现有透明效果
3. 移动窗体,透明效果失败

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

Please provide any additional information below.

每次重绘窗体时可以出现透明效果,但是移动或者最大化或��
�最小化时 明显看出这个bug了

Original issue reported on code.google.com by tangxunm...@gmail.com on 27 Mar 2012 at 8:04

GoogleCodeExporter commented 8 years ago
好像duilib不能实现异性窗口啊,就是实现窗口剪裁。
利用duilib读取png透明图片作背景创建异性窗口时,图片透明��
�可以正常显示,但是窗口不是异性的。只是png透明部分没有�
��示。也就是说窗口没有按照图片进行剪裁,还是规则的长方
形窗口,只是透明部分没有显示,这样duilib窗口不能及时更��
�,背景还会显示为规则长方形。除非最小化窗口重新激活窗�
��重画。

Original comment by softre...@gmail.com on 17 Aug 2012 at 1:45

GoogleCodeExporter commented 8 years ago
顶起来啊,我也发现了这个问题,背景黑色总是存在,我的��
�景png边缘是半透明阴影效果

Original comment by haha459...@gmail.com on 17 Aug 2012 at 2:39

GoogleCodeExporter commented 8 years ago
http://code.google.com/p/duilib/issues/detail?id=53#c2
我自己解决了

Original comment by haha459...@gmail.com on 31 Aug 2012 at 11:43

GoogleCodeExporter commented 8 years ago
怎么解决的,代码贴上来,分享一下啊!

Original comment by daybill...@yahoo.com.cn on 10 Oct 2012 at 1:06

GoogleCodeExporter commented 8 years ago
用开源库要有共享精神啊

Original comment by melonfo...@gmail.com on 20 Feb 2013 at 9:31

GoogleCodeExporter commented 8 years ago
请看 https://code.google.com/p/duilib/issues/detail?id=75

Original comment by yuheng0...@gmail.com on 18 Apr 2013 at 2:15

GoogleCodeExporter commented 8 years ago
Window属性 bktrank="true"  alpha="0" 我是这样设置的
bktrank属性写不写貌似无所谓的,alpha必须写,但是值是多少��
�似也是无所谓的。
关键是
COLORREF clTransparent = RGB(0, 0, 0);
SetLayeredWindowAttributes(pFrame->GetHWND(), clTransparent, 0, LWA_COLORKEY);
将需要透明的颜色在主函数里设置为透明色就行了。
我这样做就OK了。

Original comment by jihailia...@gmail.com on 22 May 2013 at 2:04

Attachments:

GoogleCodeExporter commented 8 years ago
最终解决方案:
http://download.csdn.net/download/ku625/5418089
http://www.yutent.com/article-68.html

感谢来自csdn的ku625童靴

Original comment by zzhfls@gmail.com on 24 May 2013 at 8:35

GoogleCodeExporter commented 8 years ago
感谢7楼无私分享.

我处理分层异形窗口背景不透明解决方法:
1. 使用Dui 
Designer创建xml文件时,mask值有个小问题.我设置0xff00ff,但是软件
赋值为0xffff00ff,这里要把前面多余的一个字节去掉.
2. Window属性手动添加 bktrans="true".
3. 创建窗口时使用CreateDuiWindow函数来创建,代码如下:
   pFrame->CreateDuiWindow( NULL, _T(""),  WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS, WS_EX_LAYERED );
4. OnCreate事件中设置透明色,代码如下,抄7楼的.  
   COLORREF clTransparent = RGB(0xFF, 0, 0xFF);  // 和xml文件中mask一样,根据自己的图片设置
   SetLayeredWindowAttributes( GetHWND(), clTransparent, 0, LWA_COLORKEY); 

Original comment by zhao.qiz...@gmail.com on 15 Jun 2014 at 10:40