picture 显示图像
void TestDlg::ShowExpression(bool bAll ,CString csExpressionFile)
{
CImage m_Image;
csExpressionFile=_T(".\\res\\")+csExpressionFile;
m_Image.Load(csExpressionFile);//装载图片
for(int i = 0; i < m_Image.GetWidth(); i++)
{
for(int j = 0; j < m_Image.GetHeight(); j++)
{
unsigned char* pucColor = reinterpret_cast<unsigned char *>(m_Image.GetPixelAddress(i , j));
pucColor[0] = pucColor[0] * pucColor[3] / 255;
pucColor[1] = pucColor[1] * pucColor[3] / 255;
pucColor[2] = pucColor[2] * pucColor[3] / 255;
}
}
if(bAll)
{
m_picture.Invalidate();
CDC* hdc = m_picture.GetDC();
m_Image.Draw(hdc->m_hDC,0,0);
ReleaseDC(hdc);
m_picture.UpdateWindow();
CDC* hdc1 = m_picture1.GetDC();
m_Image.Draw(hdc1->m_hDC,0,0);
ReleaseDC(hdc1);
CDC* hdc2 = m_picture2.GetDC();
m_Image.Draw(hdc2->m_hDC,0,0);
ReleaseDC(hdc2);
}
}
void TestDlg::OnBnClickedStart()
{
CString csFile=_T("WaitToDo.png");
ShowExpression(true, csFile);
}
在调用这个函数后,最大化最小化后,图像全部消失
请问如何解决