SetLayeredWindowAttributes 函数的使用方法,对话框透明的方法
来源:互联网 发布:淘宝账号被冻结会怎样 编辑:程序博客网 时间:2024/05/21 11:24
这片文章来介绍一下使对话框透明的方法,使用下面的API函数,当然MFC中的CWnd类中也有该函数的(注意:我用的环境为VS2008,可以直接使用该函数,VC6.0不同的使用方法不同,网上有介绍):
函数的原型为
BOOL SetLayeredWindowAttributes(
HWND hwnd, // handle to the layered window
COLORREF crKey, // specifies the color key
BYTE bAlpha, // value for the blend function
DWORD dwFlags // action
);
其中
hWnd是透明窗体的句柄,// MFC中的CWnd类没有改参数了
crKey为掩码的颜色,可以用RGB(r,g,b)来指定。// ColorKey
bAlpha是透明度,取值范围是(0,255),其中0代表全透明,255代表不透明。
dwFlags是透明方式,可以取两个值:
当取值为LWA_ALPHA时,crKey参数无效,bAlpha参数有效;
当取值为LWA_COLORKEY时,窗体中的所有颜色为crKey的地方将变为透明,bAlpha参数无效。
LWA_ALPHA = 0x2
LWA_COLORKEY=0x1
也可以取两个值的组合:LWA_ALPHA Or LWA_COLORKEY。这样crKey的地方将变为全透明,而其它地方根据bAlpha参数确定透明度。
SetLayeredWindowAttributes(0, 200, LWA_ALPHA);
注意:
要使使窗体拥有透明效果,首先要使窗口具有WS_EX_LAYERED扩展属性,方法:
在函数OnInitDialog()中加入下面的代码
SetWindowLong(m_hWnd,GWL_EXSTYLE,GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^WS_EX_LAYERED);
0 0
- SetLayeredWindowAttributes 函数的使用方法,对话框透明的方法
- VC++ 实现整个对话框透明的效果SetLayeredWindowAttributes
- SetLayeredWindowAttributes函数的使用.
- 让对话框透明的方法
- 渐进式透明的设置(SetLayeredWindowAttributes的用法)
- 对话框中控件透明的方法
- 文件对话框函数的基本使用方法
- abap 弹出对话框函数POPUP_GET_VALUES的使用方法
- abap 弹出对话框函数POPUP_GET_VALUES的使用方法
- 窗体透明效果的实现 渐进式等SetLayeredWindowAttributes的用法
- 使用SetLayeredWindowAttributes函数设置窗口透明色与透明度
- xp下实现窗体透明特效SetLayeredWindowAttributes函数
- xp下实现窗体透明特效SetLayeredWindowAttributes函数
- xp下实现窗体透明特效SetLayeredWindowAttributes函数
- SetLayeredWindowAttributes函数
- SetLayeredWindowAttributes函数:
- WinAPI透明窗体SetLayeredWindowAttributes
- 透明化窗口SetLayeredWindowAttributes
- hbase 安装
- 项目总结-EMOJI表情处理详解(ios,android平台兼容)
- C++ explicit关键字应用方法详解
- how to use Task to represent the old Begin/End async methods
- 根据条件选择(逗号分割的绑定)后台的绑定
- SetLayeredWindowAttributes 函数的使用方法,对话框透明的方法
- cocos2d-x 2.2.1 使用列表初始化vector错误 的解决方法
- Android 项目编译过程
- C#反射机制
- OCP-1Z0-053-200题-57题-634
- 32位PLSQL Developer 不能连接 oracle 12c 64位 的解决办法 for win 64
- windows 8.1 iis无法访问数据库
- 利用/dev/mem和mmap读写linux内存的通用C代码及原理
- 深度分析IPV6 NDP邻居发现协议