01-21-2005, 07:22 PM
Hello VB community!
What is the most basic code for fading a form in and out?
I searched the web and found two sites with decent sample code for this but they both included quite a bit of extra features which seems to be a bit confusing. Basicly I just need someone to show me the basics of fading a form in and/or out.
Okay... I ready to be bedazzeled!
Coders! Start your engines!
01-21-2005, 08:30 PM
As of Win2k I think form transparency as a percentage was available from the API.
I don't think it is supported under 95,98, or 98SE.
Is this what you are talking about?
01-21-2005, 08:34 PM
As Gruff mentioned, transparency under Win 2k/XP is available via SetLayeredWindowAttributes, but nothing that easy exists for 9X.
Personally, I think programs that use form fading to close or minimize are obnoxious and slows down user productivity-but thats just me.
01-21-2005, 10:15 PM
I just started to build my database of VB stuff when I saw this. So, I helped to explain it.
01-22-2005, 11:37 AM
I'll check out that link you gave me. Thanks.
As for the 98 stuff, I don't really need it to be compatable with pre-XP/2000 systems so that API issue isn't a problem.
I guess I have to add a block of code for this though, right? I can't just do a one or two liner can I?
01-22-2005, 12:14 PM
No, it's pretty simple. All you need to do is:
1) use the GetWindowLong and SetWindowLong functions to add the WS_EX_LAYERED style to the form.
2) Whenever you want to change the form's transparency call SetLayeredWindowAttributes.
01-22-2005, 09:47 PM
Okay, thanks. That should be all I needed to know.
I appriciate it!
I'll be back