Board index » delphi » TLabel Fade in/Fade out effect

TLabel Fade in/Fade out effect

Hello,
I want to make a fade in / fade out effect when display a message on the
form using TLabel.
My idea is, use a Timer and decrease the color of the label until it match
the color of my Form.
However, problems occured. When the font size is small, it's OK. But after I
change the font size of the label to a larger one (eg. 24), the caption of
the label blinks when performing fade in/fade out effect. Is there any
method to solve that ( I think it is the problem of refreshing)?

Sorry of my poor English.
Thanks!

--
o?W|??|~o??oGh?g? [30-7s]
http://members.xoom.com/yippage
Net{*word*249}so1?2? http://home.net{*word*249}s.net/~luk
?Li? http://home.net{*word*249}s.net/~nph

 

Re:TLabel Fade in/Fade out effect


Quote
??? wrote in message <35c7009...@ruby.hknet.com>...
>Hello,
>I want to make a fade in / fade out effect when display a message on the
>form using TLabel.
>My idea is, use a Timer and decrease the color of the label until it match
>the color of my Form.
>However, problems occured. When the font size is small, it's OK. But after
I
>change the font size of the label to a larger one (eg. 24), the caption of
>the label blinks when performing fade in/fade out effect. Is there any
>method to solve that ( I think it is the problem of refreshing)?

Most likely you are seeing some screen flicker, yes.
What you could do is wait for the vertical blanking of the videocard.
I am sure windows has a routine for this, and if anyone knows it, please
inform us both, but meanwhile, you can have my assembly routine for the same
thing:

Just paste this into the routine updating the graphics BEFORE updating it.
/If the fading takes long, it would also be wise to make a call to the
application.processmessages within there.

      ASM
      push dx
      push ax
       @VBLANK:
      mov dx,03dah
      in al,dx
      and al,08h
      jz @vblank
      pop ax
      pop dx
      End;

If you fade by using a for-loop, remember that the assembly part must be
within the loop, as what it does, is just to wait for the scanline to reach
the top of your screen.

I think this will work on all resolutions and modes, but I havent used it
much since the good old 320*200*8 bit days.

Good luck!

Christian Lassem

Re:TLabel Fade in/Fade out effect


If you only want to change the label colour why not put a blank label
of the required colour behind your label and set transparent to true
for your label. Then simply fade the colour of the other label. There
should not be any redrawing of the text (I hope since I have not tried
it). Its worth a try.

Regards
John Collins

Quote
>I want to make a fade in / fade out effect when display a message on
the
>form using TLabel.
>My idea is, use a Timer and decrease the color of the label until it
match
>the color of my Form.
>However, problems occured. When the font size is small, it's OK. But
after I
>change the font size of the label to a larger one (eg. 24), the
caption of
>the label blinks when performing fade in/fade out effect. Is there
any
>method to solve that ( I think it is the problem of refreshing)?

Re:TLabel Fade in/Fade out effect


Actually I want to fade the color of the text but not the color of the
label...
Anyway, thanks for anwsering my question.

Dr J D Collins ???g??31 <35c7220a.0@news>...

Quote
>If you only want to change the label colour why not put a blank label
>of the required colour behind your label and set transparent to true
>for your label. Then simply fade the colour of the other label. There
>should not be any redrawing of the text (I hope since I have not tried
>it). Its worth a try.

>Regards
>John Collins

>>I want to make a fade in / fade out effect when display a message on
>the
>>form using TLabel.
>>My idea is, use a Timer and decrease the color of the label until it
>match
>>the color of my Form.
>>However, problems occured. When the font size is small, it's OK. But
>after I
>>change the font size of the label to a larger one (eg. 24), the
>caption of
>>the label blinks when performing fade in/fade out effect. Is there
>any
>>method to solve that ( I think it is the problem of refreshing)?

Re:TLabel Fade in/Fade out effect


Quote
>Hello,
>I want to make a fade in / fade out effect when display a message on the
>form using TLabel.
>My idea is, use a Timer and decrease the color of the label until it match
>the color of my Form.
>However, problems occured. When the font size is small, it's OK. But after
I
>change the font size of the label to a larger one (eg. 24), the caption of
>the label blinks when performing fade in/fade out effect. Is there any
>method to solve that ( I think it is the problem of refreshing)?

Our library can do that and many more. Just see the compiled exe demo (with
complete sources). There is an example of a TLabel fade in the 'Transitions'
section.

Here is a description of the product:
FormContainer is a Delphi native component that makes possible to insert a
form as a child window into another form. You can easily develope very
complex interfaces that are much more powerful, robust and user-friendly.
When switching forms you can make transition effects ideal for multimedia
applications.
You can use transitions with any other control, and construct custom
transitions.Download the fully functional evaluation version (nagware) with
a demo project (source and compiled exe) at http://www.torry.ru/forms2.htm

Regards,
Francisco Sanchez
formcontai...@apdo.com

Other Threads