Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control that "Fades" From View

Status
Not open for further replies.
May 7, 1999
130
US
Hi!

Ever see images in PowerPoint that fade in or fade out?

I'd like to include my company's logo, name, address and phone number on the screen for a short period of time, say 2 seconds and then fade out. I want something fairly unobtrusive that provides advertising for me, but not so long that anyone balks. At any time, I want the user to be able to select an item from the menu and skip the remainder of the fade-out.

Thanks, John Harkins
 
You could set a timer event to populate an image control with a series of graphics, with each successive graphic faded out compared to the previous.

A way to do it with a text or label control using the same kind of timer event that I described above, would be to incrementally lighten the fore color of the control until it fades to equal the back color.

To interrupt the event so that users don't ahve to watch fade out, you could kill the event with an if statement asking if any other controls have been - if true, then hide the control and exit the timer event.
 
Is there a place where the color values are described? I understand the concept and appreciate the confirmation that I'm on the right track, but I really want to understand better the numbering convention for light and dark (less to more saturation?) shades of color.

Thanks, John Harkins
 
The fore and back colors range from a value of 0 for black to a value of 16777215. But I'm not sure exactly how to scale it to give the appearance of a gradual fade from one to another. You could play with the "define custom color" option (click the ellipses next to one of the color options in the properties screen for a control) and use that to select the range of colors you'd want the font to cycle through.

Alternatively, you could probably define the colors in VBA using the RGB color values. (e.g. txtbox.forecolor = rgb(255,0,0) - this should generate red text in the control.)

I'm sure that there's a more scientific approach than what I've described, but I don't know it off hand.
 
If you want to take control over raster operations you're going to need to resort to the API and some fairly complex code. Windows has a complete set of drawing API's you can use to manipulate images programmatically.

The best source I've found for VB is the 'Visual Basic Programmer's Guide to the Win32 API' by Dan Appleman. It includes several pre-compiled VB projects that demonstrate bitmap fades and other drawing operations, however I can't share it here because it is copyrighted.

If you don't want to buy the book, look into the 'BltBlt' and 'PatBlt' API functions in your MSDN help library to see what is possible.

Good Luck,
VBSlammer
redinvader3walking.gif
 
WOW... didn't know it needed to be so complicated!

Thanks, John Harkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top