原图,图片来源网络
效果图
int nWidth = this->GetWidth();
int nHeight = this->GetHeight();
RECT rt = this->GetPos();
// 内存位图画板,多留2个像素,避免被边框切掉
Bitmap bitmapTmp(m_bkGDIPimage->GetWidth()+2,m_bkGDIPimage->GetHeight()+2);
Graphics gBig(&bitmapTmp);
Graphics g(hDC);
gBig.SetSmoothingMode(Gdiplus::SmoothingModeHighQuality);
GraphicsPath path(FillModeAlternate);
// 圆形大小
path.AddEllipse(1,1,m_bkGDIPimage->GetWidth(),m_bkGDIPimage->GetHeight());
// 已经将圆形图片画到了gBig上了
gBig.FillPath(&TextureBrush(m_bkGDIPimage), &path);
SmoothingMode mode = g.GetSmoothingMode();
g.SetSmoothingMode(SmoothingMode::SmoothingModeHighQuality);
g.DrawImage(&bitmapTmp, rt.left, rt.top, nWidth, nHeight);
g.SetSmoothingMode(mode);