From: k.sahici on
On Jun 15, 4:55 am, "ScottMcP [MVP]" <scott...(a)mvps.org> wrote:
> On Jun 14, 2:50 pm, "k.sahici" <k.sah...(a)gmail.com> wrote:
>
> > I'm really confused. Assume that I had written a library to display
> > jpg files. What would I be supposed to do in order to remove the image
> > from the dialog?  I really don't know much about diplaying image
> > files.
>
> The Unload function should call Invalidate, which causes WM_PAINT to
> be generated.  The control's WM_PAINT handler must paint something:
> whatever should appear after the image is unloaded.  Do you have the
> source code for this control?

You can download the source code from http://www.codeproject.com/KB/graphics/pictureex.aspx.
It has been designed to display .gif files but it supports jpg files
as well. I also see that the UnLoad function doesn't call Invalidate.
I tried to add this call to the UnLoad function and recompiled the
project but that didn't work, too.
From: Alex Blekhman on
On 15-Jun-10 16:15, k.sahici wrote:
> I also see that the UnLoad function doesn't call Invalidate.
> I tried to add this call to the UnLoad function and recompiled the
> project but that didn't work, too.

Have you seen the Preben Friis' answer? He correctly identified the
problem and suggested working solution.

Alex
From: k.sahici on
On Jun 15, 10:57 am, Alex Blekhman <t...(a)yahoo.com> wrote:
> On 15-Jun-10 16:15, k.sahici wrote:
>
> > I also see that the UnLoad function doesn't call Invalidate.
> > I tried to add this call to the UnLoad function and recompiled the
> > project but that didn't work, too.
>
> Have you seen the Preben Friis' answer? He correctly identified the
> problem and suggested working solution.
>
> Alex

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?
Kivanc
From: Preben Friis on
"Alex Blekhman" <tkfx(a)yahoo.com> wrote in message
news:4c173266$0$277$14726298(a)news.sunsite.dk...
> Have you seen the Preben Friis' answer? He correctly identified the
> problem and suggested working solution.

It seems that Google Groups did not pick up what I sent... !? I have sent
the answer to the OP by email now.

/Preben Friis

From: Alex Blekhman on
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