我使用GDI +使用此类在CStatic *element
上绘制图像:
https://www.codeproject.com/Articles/24969/An-MFC-picture-control-to-dynamically-show-picture
这是我的代码onDraw
void CPictureCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (mBIsPicLoaded) {
RECT rc;
this->GetClientRect(&rc);
Graphics graphics(lpDrawItemStruct->hDC);
Image image(mPstream);
graphics.DrawImage(&image, (INT)rc.left, (INT)rc.top, (INT)(rc.right - rc.left), (INT)(rc.bottom - rc.top));
}
}
图像显示为矩形。但我想说清楚。 怎么做 ? 感谢