15,979
社区成员
发帖
与我相关
我的任务
分享
HDC hDC = ::GetDC(m_hWnd);
RECT r;
GetClientRect(&r);
HBITMAP hBmp = ::CreateCompatibleBitmap(hDC,r.right,r.bottom);
HDC hMemDC = ::CreateCompatibleDC(hDC);
::SelectObject(hMemDC,hBmp);
Graphics g(hMemDC);
g.SetSmoothingMode(SmoothingModeHighQuality);
g.FillRectangle(&SolidBrush(Color::Red), 0, 0, r.right, r.bottom); //background
if (boundColor.GetAlpha() != 0) {
g.DrawRectangle(&Pen(boundColor),0,0,r.right,r.bottom);
}
g.FillPath(textBrush,textPath);
BLENDFUNCTION blend = { AC_SRC_OVER, 0, m_transparency, AC_SRC_ALPHA };
POINT p = {0,0};
if (::UpdateLayeredWindow(m_hWnd,hDC,NULL,NULL,hMemDC,&p,0,&blend,ULW_ALPHA|ULW_COLORKEY) == TRUE) AfxMessageBox(L"update!!");
else
{
DWORD e = GetLastError();
ASSERT("%d",e);
}
::DeleteObject(hBmp);
::DeleteDC(hMemDC);
::ReleaseDC(m_hWnd,hDC);