15,979
社区成员
发帖
与我相关
我的任务
分享
Image imgBox(L"images\\Stripe.png", FALSE);
int imgcx = imgBox.GetWidth();
int imgcy = imgBox.GetHeight();
CRect rect(GetSystemMetrics(SM_CXSCREEN)/2-imgBox.GetWidth()/2+5,
GetSystemMetrics(SM_CYSCREEN)/2-imgBox.GetHeight()/2+3,
GetSystemMetrics(SM_CXSCREEN)/2-imgBox.GetWidth()/2+5+imgcx-10,
GetSystemMetrics(SM_CYSCREEN)/2-imgBox.GetHeight()/2+3+imgcy-6);
HDC hdc = ::GetDC(0);
HDC memDC = CreateCompatibleDC(hdc); // 绘图内存DC
HBITMAP mybitmap = CreateCompatibleBitmap(hdc, rect.Width(), rect.Height());
SelectObject(memDC,mybitmap);
BitBlt(memDC,0,0, rect.right-rect.left+1, rect.bottom-rect.top+1, hdc,0,0,SRCCOPY);
bitmap.Attach((HBITMAP)mybitmap);
//创建一个透明的画刷
//bitmap.LoadBitmap(IDB_BMP);//这是原本的代码
m_brush.CreateStockObject(NULL_BRUSH);