From: k.sahici on
On Jun 15, 1:52 pm, Alex Blekhman <t...(a)yahoo.com> wrote:
> On 15-Jun-10 18:47, k.sahici wrote:
>
> >> Have you seen the Preben Friis' answer? He correctly identified the
> >> problem and suggested working solution.
>
> > I didn't see it and I still can't see it. He didn't post to this
> > topic.Are you talking about some other topic?
>
> For some strange reason I can see the post in my newsreader but cannot
> find it with Google. So here is the post:
>
> -------
> I found the CPictureEx class, and determined that the code is indeed
> broken. When it paints itself after UnLoad, it blits a NULL DC to the
> screen (which does nothing).
>
> Solution:
>
> In "void CPictureEx::OnPaint()" Change:
>
>     ::BitBlt(dc.m_hDC, 0, 0, m_PictureSize.cx, m_PictureSize.cy,
> m_hMemDC, 0, 0, SRCCOPY);
>
> to
>
>     if (m_hMemDC)
>     {
>         ::BitBlt(dc.m_hDC, 0, 0, m_PictureSize.cx, m_PictureSize.cy,
> m_hMemDC, 0, 0, SRCCOPY);
>     }
>     else
>     {
>         CBrush brush(GetSysColor(COLOR_3DFACE));
>         CRect rect(CPoint(0, 0), GetSize());
>         dc.FillRect(rect, &brush);
>     }
>
> .. and then you can just call:
>
>     m_Picture.UnLoad();
>     m_Picture.Invalidate();
>
> ...in the dialog implementation.
>
> /Preben Friis
> -------
>
> HTH
> Alex

Alex, thank you very much for posting Preben's answer once again,
without you I would still be looking for the answer.

Preben, thank you so much for pointing out the problem and suggesting
the solution. It works like a charm now :)

Kivanc