我想实现用slider滑块控制窗体的透明度。
手上现在有一段源码,如下: 放在OnInitDialog中可以看到效果,但是透明值得手动的改。
SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE)|0x80000);
typedef BOOL (WINAPI *FSetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD); FSetLayeredWindowAttributes SetLayeredWindowAttributes ; HINSTANCE hInst = LoadLibrary("User32.DLL"); SetLayeredWindowAttributes = (FSetLayeredWindowAttributes)GetProcAddress(hInst,"SetLayeredWindowAttributes"); if (SetLayeredWindowAttributes)
SetLayeredWindowAttributes(GetSafeHwnd(),RGB(0,0,0),128,2);
FreeLibrary(hInst);现在我想用slider控件控件透明值,时时能看到效果。怎么弄?