Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to keep image displayed in dialog box?

How to keep image displayed in dialog box?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestiontutorial
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houari_id
    wrote on last edited by
    #1

    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!

    C 1 Reply Last reply
    0
    • H houari_id

      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!

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      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 ?

      H 1 Reply Last reply
      0
      • C Cedric Moonen

        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 ?

        H Offline
        H Offline
        houari_id
        wrote on last edited by
        #3

        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

        C 1 Reply Last reply
        0
        • H houari_id

          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

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          Did you check with your debugger if the code that draws your image is called in that case ?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups