From: Lewis Z. on
On Apr 21, 1:49 pm, "David Ching" <d...(a)remove-this.dcsoft.com> wrote:
> "Lewis Z." <lzh...(a)gmail.com> wrote in message
>
> news:f249de46-a08f-4c8e-b1ad-3a9728494b86(a)z7g2000yqb.googlegroups.com...
>
> > Are you suggesting something like this,
>
> >        SetDlgItemText(staticId, pTxt);
> >        ShowWindow(SW_HIDE);
> >        ShowWindow(SW_SHOW);
>
> > If so, this doesn't work for me. The reason is that Hide/Show causes
> > the window blinking all the time because I have timer running in the
> > background to update the texts. Although this will remove all garbled
> > texts, I cannot use it and user won't be happy either.
>
> No, I am suggesting something like:
>
>   GetDlgItem(staticId)->ShowWindow(SW_HIDE);
>   GetDlgItem(staticId)->ShowWindow(SW_SHOW);
>
> -- David

I did try HIDE/SHOW on the static controls this morning. I probably
did something wrong. It works now.

David, thanks a million.
From: David Ching on
"Lewis Z." <lzhou8(a)gmail.com> wrote in message
news:aec1788c-59c8-42a4-bc66-12044b17be74(a)k41g2000yqf.googlegroups.com...
> I did try HIDE/SHOW on the static controls this morning. I probably
> did something wrong. It works now.
>
> David, thanks a million.

So glad to hear it Lewis! :-)

-- David

From: Joseph M. Newcomer on
Note that doing an Invalidate() on the parent says "please redraw the entire parent"
whereas my code says "please redraw the piece of the parent under my window". Big
difference!

But the hide/show might work as well.
joe
On Wed, 21 Apr 2010 10:55:12 -0700, "David Ching" <dc(a)remove-this.dcsoft.com> wrote:

>"Lewis Z." <lzhou8(a)gmail.com> wrote in message
>news:f11ffc9b-d2af-43db-be64-aeb4d2732f10(a)c21g2000yqk.googlegroups.com...
>>> CRect r;
>>> GetWindowRect(&r);
>>> CWnd * parent = GetParent();
>>> parent->ScreenToClient(&r);
>>> parent->Invalidate(&r);
>>>
>>> to force the parent area to redraw under the control.
>>
>> I have this in my code except I Invalidate the static controls instead
>> of the whole dialog box. Otherwise the screen is blinking everytime
>> the texts are updating.
>>
>
>Instead of doing Invalidate(), do a ShowWindow(SW_HIDE); followed by
>ShowWindow(SW_SHOW);
>Invalidating doesn't work because your transparent brush won't erase the
>current contents, so if the new contents don't match exactly, it will appear
>garbage. I notice a funny effect with ClearType enabled that the new
>contents don't exactly match the old contents even though the string is the
>same (it looks like the text is shifted by a subpixel or two).
>
>-- David
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Lewis Z. on
On Apr 21, 11:04 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
> Note that doing an Invalidate() on the parent says "please redraw the entire parent"
> whereas my code says "please redraw the piece of the parent under my window".  Big
> difference!
>
> But the hide/show might work as well.
>                         joe
>
>
>
>
>
> On Wed, 21 Apr 2010 10:55:12 -0700, "David Ching" <d...(a)remove-this.dcsoft.com> wrote:
> >"Lewis Z." <lzh...(a)gmail.com> wrote in message
> >news:f11ffc9b-d2af-43db-be64-aeb4d2732f10(a)c21g2000yqk.googlegroups.com....
> >>>         CRect r;
> >>>         GetWindowRect(&r);
> >>>         CWnd * parent = GetParent();
> >>>         parent->ScreenToClient(&r);
> >>>         parent->Invalidate(&r);
>
> >>> to force the parent area to redraw under the control.
>
> >> I have this in my code except I Invalidate the static controls instead
> >> of the whole dialog box. Otherwise the screen is blinking everytime
> >> the texts are updating.
>
> >Instead of doing Invalidate(), do a ShowWindow(SW_HIDE); followed by
> >ShowWindow(SW_SHOW);
> >Invalidating doesn't work because your transparent brush won't erase the
> >current contents, so if the new contents don't match exactly, it will appear
> >garbage.  I notice a funny effect with ClearType enabled that the new
> >contents don't exactly match the old contents even though the string is the
> >same (it looks like the text is shifted by a subpixel or two).
>
> >-- David
>
> Joseph M. Newcomer [MVP]
> email: newco...(a)flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text -
>
> - Show quoted text -

Yes, it works if changing last statement Invalidate() to
InvalidateRect(). My original code was like that. Unfortunately, I had
an extra line UpdateWindow() after InvalidateRect(), which caused all
the mess.

Joe, thanks a million too. :)