VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

ColorGradient Class

Brian Zablocky  (4 Submissions)   Miscellaneous   VB Script   Advanced   Wed 3rd February 2021

This is an improvement upon my ColorFade class. Supply up to 11 colors (0% to 100% by 10%) and it will produce a gradient on your form or picture box. Optionally choose up to 8 sources for the gradient (4 sides, 4 corners). The only file needed is the class module. The test project is for demonstration purposes. Updated with comments. Added a new UnSetColor method.

Inputs
Include the class in your project and declare it. Specify up to 11 colors and a gradient source using the SetColor method with an index of 0 through 10. Use the PaintObject method to draw the gradient.

Assumes
This code does not require ColorFade. It is standalone. Much of the code in this class was derived from ColorFade. If you need a midpoint color, use ColorFade instead of ColorGradient.

Returns
A gradient drawn on a form or picture box.

Side Effects
Make sure the auto-redraw is on. After you draw the gradient on an object, call the object's Refresh method.

API Declarations
'
' No API. Pure VB
'

Rate ColorGradient Class (5(5 Vote))

Download ColorGradient Class

ColorGradient Class Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters