Re: Clear CWnd Child with png
Define what you mean by this. You said you wanted transparent parts,
which means you will
be able to see the first image through the second, at least at the
transparent parts. Or
are you seeing it in some other way? Are you creating a transparent
window in some way,
or using alpha blending? The only alpha blending I see is 255 (100%, no
transparency).
Yes I see the first Image through the second.
But I actually want to replace one bitmap with the other. and I want to
see the background of the parent CWnd.
I dont wan't to use alphablending yet, but maybe in future.
Override OnEraseBkgnd and do nothing. In OnPaint, do nothing if there is
nothing to draw.
Ok I did.
I hope you do NOT "call" OnPaint. If you did
switch pointers
OnPaint();
it cannot POSSIBLY work, ever. So whatever you are getting is no
indication of correct
behavior. If, on the other hand, you did
Now I don't call OnPaint but DrawItem() directly from OnMouseMove and
OnmouseLeave:
void CLitBoardItem::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: F?gen Sie hier Ihren Meldungsbehandlungscode ein, und/oder
benutzen Sie den Standard.
mp_ActiveBook=&m_BookImageOpen;
DrawItem();
CWnd::OnMouseMove(nFlags, point);
}
void CLitBoardItem::OnMouseLeave()
{
m_bMouseTracking = FALSE;
mp_ActiveBook=&m_BookImage;
DrawItem();
CWnd::OnMouseLeave();
}
int CLitBoardItem::DrawItem(void)
{
CWindowDC pDC(this);
CRect rect;
Invalidate();
UpdateWindow();
mp_ActiveBook->AlphaBlend(pDC.m_hDC,0,0);
return 0;
}
The OnPaint is now empty.