VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ColorFade Class

by Brian Zablocky (4 Submissions)
Category: Miscellaneous
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (9 Votes)

This is a class module that will return a midpoint color between a start and end color. You specify the start color, end colors, and a percentage to find out what color falls in between. A method is included to draw gradients on a form or picture box.
This is a standalone class module. A project is included for testing the class, but you only need the class module in your final code.

Inputs
Supply a start and end color as a long number, probably using the built-in RGB() function. When you are ready to find a midpoint color, supply a percentage. 0% is the start color and 100% is the end color. If you want to use form or picture gradients, you need to supply the object name.
Assumes
Comes with an excellent project to demonstrate the class, but all you need is the class itself. Simply include the class module with your application and your there! Fairly small footprint.
Code Returns
Returns a long number specifying the in-between number. This uses the individual Red, Green, and Blue channels, not the finished long number to determine, so you get a "perfect" fade. For form and picture gradients, the drawing is done automatically using the built in Line()-() method.
Side Effects
Frames do not look good on top of a gradient. It is recommended that you draw your frame inside of a picture box. Also, you will have to turn on the auto-redraw of the form or picturebox.
API Declarations
'
'No API usage. Globals in the test project are for the test project only.
'

Rate ColorFade Class

Download ColorFade Class

Download ColorFade Class (11 KB)

ColorFade Class Comments

No comments have been posted about ColorFade Class. Why not be the first to post a comment about ColorFade Class.

Post your comment

Subject:
Message:
0/1000 characters