AlphaBlend实现透明效果,只是仅仅能针对某块区域进行alpha操作,透明度可设。
TransparentBlt能够针对某种颜色进行透明,只是透明度不可设。
AlphaBlend:
BLENDFUNCTION bn; bn.AlphaFormat = 0; bn.BlendFlags = 0; bn.BlendOp = AC_SRC_OVER; bn.SourceConstantAlpha = 0; //透明度设置,0为不透明;255为全然透明
AlphaBlend(hMemDC,0,385,320,95,hBackGroundDC,0,385,320,95,bn); |
bn.SourceConstantAlpha =
0:
bn.SourceConstantAlpha = 100:
bn.SourceConstantAlpha = 255:
TransparentBlt:
TransparentBlt(hMemDC,10,0,296,20,hBarDCW,0,0,296,20,RGB(0,0,0));//指定RGB(0,0,0)透明
BitBlt(hMemDC, 10, 21, 296, 20, hBarDCW, 0, 0, SRCCOPY); |
原文地址:http://www.cnblogs.com/liuhg/p/scan.html