15,978
社区成员
发帖
与我相关
我的任务
分享
Graphics graphics(pDC->m_hDC);
//graphics.Clear(0xffffffff);
graphics.DrawImage(m_pImgBk, Rect(0, 0, m_width, m_height), nsPos, 0, m_width, m_height, UnitPixel);
CRect rcClient;
GetClientRect(&rcClient);
ClientToScreen(&rcClient);
GetParent()->ScreenToClient(&rcClient);
GetParent()->InvalidateRect(rcClient,true);//每次绘制透明图片前,更新按钮所在新父窗口区域,按钮的背景也会更新
GetParent()->UpdateWindow();
CClientDC dc(this);
DrawButton(&dc);
ReleaseDC(&dc);
CDC paintDC;
CBitmap bmp;
paintDC.CreateCompatibleDC(pDC);
bmp.CreateCompatibleBitmap(pDC, m_width, m_height);
paintDC.SetBkMode(TRANSPARENT);
CBitmap * pOldBmp = paintDC.SelectObject(&bmp);
Graphics graphics(paintDC.GetSafeHdc());
//graphics.Clear(0xffffffff);
graphics.DrawImage(m_pImgBk, Rect(0, 0, m_width, m_height), nsPos, 0, m_width, m_height, UnitPixel);
pDC->BitBlt(0,0,m_width, m_height, &paintDC, 0, 0, SRCCOPY);
paintDC.SelectObject(pOldBmp);
bmp.DeleteObject();
paintDC.DeleteDC();
Bitmap bt1(L"12.jpg");
Bitmap bitmap(200,200);
Graphics* grph = Graphics::FromImage(&bitmap);
grph->画一下背景
grph ->DrawImage(&bt1, 0, 0);
Graphics graphics(hdc);
graphics->DrawImage(&bitmap,0 ,0);
delete grph;
CDC paintDC;
CBitmap bmp;
paintDC.CreateCompatibleDC(pDC);
bmp.CreateCompatibleBitmap(pDC, m_width, m_height);
paintDC.SetBkMode(TRANSPARENT);
CBitmap * pOldBmp = paintDC.SelectObject(&bmp);
Graphics graphics(paintDC.GetSafeHdc());
//graphics.Clear(0xffffffff);
graphics.DrawImage(m_pImgBk, Rect(0, 0, m_width, m_height), nsPos, 0, m_width, m_height, UnitPixel);
pDC->BitBlt(0,0,m_width, m_height, &paintDC, 0, 0, SRCCOPY);
paintDC.SelectObject(pOldBmp);
bmp.DeleteObject();
paintDC.DeleteDC();