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