.NET(winfrom)中button控件怎么设置成透明?

来源:百度知道 编辑:UC知道 时间:2024/09/20 04:16:34
谢谢

你自己从CWnd派生出一个Button类
通过下面代码来使窗口半透明:
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,deep,2);
FreeLibrary(hInst);
}

没有~只能自己重写一个控件

有一个背景色就是透明吧