15,979
社区成员
发帖
与我相关
我的任务
分享
void CPicStatic::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: 在此处添加消息处理程序代码
// 不为绘图消息调用 CStatic::OnPaint()
//建立图形对象
Graphics mGraphics(this->GetDC()->m_hDC);
//装入图像文件
Bitmap bmp(m_strPath.AllocSysString());
//获取控件大小
CRect lRect;
this->GetClientRect(&lRect);
RectF rt(lRect.left,lRect.top,lRect.right,lRect.bottom);
mGraphics.DrawImage(&bmp,rt);
}