实现自定义控件透明在OnPaint中调用父窗口的DC,
BackDC.BitBlt(0, 0, rect1.Width(), rect1.Height(), GetParent()->GetDC(), rect1.left, rect1.top, SRCCOPY);
控件实现了透明,可是原来的图像没有擦除,或者是因为取得父窗口的DC中包含原来的图像该怎么解决?谢谢~~
BackDC.BitBlt(0, 0, rect1.Width(), rect1.Height(), GetParent()->GetDC(), rect1.left, rect1.top, SRCCOPY);
控件实现了透明,可是原来的图像没有擦除,或者是因为取得父窗口的DC中包含原来的图像该怎么解决?谢谢~~
更新时使用此背景
GetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE)^0x80000);
HINSTANCE hInst = LoadLibrary("User32.DLL");
if(hInst)
{
typedef BOOL (WINAPI *DLGFUNC)(HWND,COLORREF,BYTE,DWORD);
DLGFUNC fun = NULL;
fun=(DLGFUNC)GetProcAddress(hInst, "SetLayeredWindowAttributes");
if(fun)fun(this->GetSafeHwnd(),0,(255*50)/100,2);
FreeLibrary(hInst);