20%透明效果如下图:
href="http://www.j2megame.org/wupei/plugins/plogeshi/styles/plogeshi.css" type="text/css" rel="stylesheet" />
具体代码实现:
-
//参数说明:透明度(范围是0-255)
-
void CSizeDlg::SetWindowAttributes(int Attributes)
-
{
-
//////////////////////////////////////////////////////////////////////////
-
//透明实现
-
SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,
-
GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
-
HINSTANCE hInst = LoadLibrary("User32.DLL");
-
if(hInst)
-
{
-
typedef BOOL (WINAPI *MYFUNC)(HWND,COLORREF,BYTE,DWORD);
-
MYFUNC fun = NULL;
-
-
//取得SetLayeredWindowAttributes函数指针
-
fun=(MYFUNC)GetProcAddress(hInst,"SetLayeredWindowAttributes");
-
if(fun)fun(this->GetSafeHwnd(),0,Attributes,2);
-
FreeLibrary(hInst);
-
}
-
//////////////////////////////////////////////////////////////////////////
-
}
这个函数在Vista下,使用也可实现透明效果