Problem with AlphaBlend.
-
I display the 32 bit icon with transparency using the AlphaBlend function. If the window with the icon is moved partially outside the monitor screen, the transparent area in some places is filled. Damaged places with partial transparency.. Any idea what it might be?
-
I display the 32 bit icon with transparency using the AlphaBlend function. If the window with the icon is moved partially outside the monitor screen, the transparent area in some places is filled. Damaged places with partial transparency.. Any idea what it might be?
-
Member 12661464 wrote:
Any idea what it might be?
Maybe the Window is not getting refreshed properly. Do you have code that is controlling when the icon gets painted?
I just put the following code in the OnPaint () handler.
CPaintDC dc(this);
CDC *psrcDC = m_PictureControl.GetDC();
CDC dstDC;
dstDC.CreateCompatibleDC(psrcDC);
HBITMAP oldBmp = (HBITMAP)SelectObject(dstDC.m_hDC, startBitmap);
BLENDFUNCTION blend = { AC_SRC_OVER, 0,255, AC_SRC_ALPHA };
AlphaBlend(psrcDC->m_hDC, 0, 0, iWidth, iHeight, dstDC.m_hDC,0, 0, iWidth, iHeight, blend);
DeleteObject(oldBmp);
DeleteObject(startBitmap);
ReleaseDC(psrcDC); -
I just put the following code in the OnPaint () handler.
CPaintDC dc(this);
CDC *psrcDC = m_PictureControl.GetDC();
CDC dstDC;
dstDC.CreateCompatibleDC(psrcDC);
HBITMAP oldBmp = (HBITMAP)SelectObject(dstDC.m_hDC, startBitmap);
BLENDFUNCTION blend = { AC_SRC_OVER, 0,255, AC_SRC_ALPHA };
AlphaBlend(psrcDC->m_hDC, 0, 0, iWidth, iHeight, dstDC.m_hDC,0, 0, iWidth, iHeight, blend);
DeleteObject(oldBmp);
DeleteObject(startBitmap);
ReleaseDC(psrcDC);