How to keep image displayed in dialog box?
-
Dear all.. I am using CxImage library to decode a JPEG stream from file, and it is fine. My problem is, how can I keep the image not to disappear from the dialog box everytime I change my window (alt-tab, or minimizing my app.). I am using this code:
CDC *pDC = m_ImgHolder.GetDC(); CRect pRect; m_ImgHolder.GetClientRect(&pRect); if (isImage) image->Draw(pDC->GetSafeHdc(), 0, 0, pRect.Width(), pRect.Height(), 0, true);
I usually put this code inside OnPaint() method, but it does not seems to work now... Need help... Thanks in advance! -
Dear all.. I am using CxImage library to decode a JPEG stream from file, and it is fine. My problem is, how can I keep the image not to disappear from the dialog box everytime I change my window (alt-tab, or minimizing my app.). I am using this code:
CDC *pDC = m_ImgHolder.GetDC(); CRect pRect; m_ImgHolder.GetClientRect(&pRect); if (isImage) image->Draw(pDC->GetSafeHdc(), 0, 0, pRect.Width(), pRect.Height(), 0, true);
I usually put this code inside OnPaint() method, but it does not seems to work now... Need help... Thanks in advance!If it is done in OnPaint, then it should work. Did you check with your debugger if the code is executed when your window is refreshed ? Also, what is the value of isImage ?
-
If it is done in OnPaint, then it should work. Did you check with your debugger if the code is executed when your window is refreshed ? Also, what is the value of isImage ?
Hi, thank you for your reply... I already put the code on OnPaint(). And this thing happen: when I use alt-tab to move to another window, and return to my app., the image disappear. But if then I move (drag) the dialog so the image section goes outside the screen and return it back, the image also returns.... :confused: isImage is only a boolean of confirming that the image data is valid
isImage = (image.IsValid())?true:false;
thank you -
Hi, thank you for your reply... I already put the code on OnPaint(). And this thing happen: when I use alt-tab to move to another window, and return to my app., the image disappear. But if then I move (drag) the dialog so the image section goes outside the screen and return it back, the image also returns.... :confused: isImage is only a boolean of confirming that the image data is valid
isImage = (image.IsValid())?true:false;
thank youDid you check with your debugger if the code that draws your image is called in that case ?