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. CPicture control

CPicture control

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 Posts 3 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.
  • S Offline
    S Offline
    Suvendra
    wrote on last edited by
    #1

    I have a few Property pages (not Wizard). On one of these I am displaying a picture (Picture Control). The file name is in a global variable. When I initialize it, the picture is displayed correctly. If a file is loaded, I want to show the picture when the user switches between the tabs. Currently when I come back to the tab with picture it is not displaying again. I have written the following code in OnSetActive event - if (g_strFileName != "") { CDC *dc; dc = GetDC(); CPicture ppic; ppic.Load(g_strFileName); CRect rc; GetDlgItem(IDC_RECT_BITMAP)->GetWindowRect(rc); ScreenToClient(&rc); ppic.Render(dc, rc); ReleaseDC(dc); } I am also calling Invalidate(TRUE) in InitDialog. Any help would be appreciated. I have also tried OnPaint/ InitDialog etc. No luck. Thanks.

    A 1 Reply Last reply
    0
    • S Suvendra

      I have a few Property pages (not Wizard). On one of these I am displaying a picture (Picture Control). The file name is in a global variable. When I initialize it, the picture is displayed correctly. If a file is loaded, I want to show the picture when the user switches between the tabs. Currently when I come back to the tab with picture it is not displaying again. I have written the following code in OnSetActive event - if (g_strFileName != "") { CDC *dc; dc = GetDC(); CPicture ppic; ppic.Load(g_strFileName); CRect rc; GetDlgItem(IDC_RECT_BITMAP)->GetWindowRect(rc); ScreenToClient(&rc); ppic.Render(dc, rc); ReleaseDC(dc); } I am also calling Invalidate(TRUE) in InitDialog. Any help would be appreciated. I have also tried OnPaint/ InitDialog etc. No luck. Thanks.

      A Offline
      A Offline
      Abhi Lahare
      wrote on last edited by
      #2

      1. Are you returning CPropertyPage::OnSetActive(); in from your OnSetActive() function? I am also calling Invalidate(TRUE) in InitDialog. Any help would be appreciated. I have also tried OnPaint/ InitDialog etc. No luck. Thanks. --> InitDialog() function is only called once and not everytime you navigate through the tab pages. so it won;t help. Thanks Abhi Lahare

      A 2 Replies Last reply
      0
      • A Abhi Lahare

        1. Are you returning CPropertyPage::OnSetActive(); in from your OnSetActive() function? I am also calling Invalidate(TRUE) in InitDialog. Any help would be appreciated. I have also tried OnPaint/ InitDialog etc. No luck. Thanks. --> InitDialog() function is only called once and not everytime you navigate through the tab pages. so it won;t help. Thanks Abhi Lahare

        A Offline
        A Offline
        Anonymous
        wrote on last edited by
        #3

        Yes, I am returning return CPropertyPage::OnSetActive();

        1 Reply Last reply
        0
        • A Abhi Lahare

          1. Are you returning CPropertyPage::OnSetActive(); in from your OnSetActive() function? I am also calling Invalidate(TRUE) in InitDialog. Any help would be appreciated. I have also tried OnPaint/ InitDialog etc. No luck. Thanks. --> InitDialog() function is only called once and not everytime you navigate through the tab pages. so it won;t help. Thanks Abhi Lahare

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          Thanks Abhi for replying to my question :-D. I somehow found a solution. I made the picture control Transparent and Simple and moved the painting code to OnPaint. Now it seems to be working perfectly fine. Still not sure what the problem was :confused:.

          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