Class TMovingGradient (unit Moving) |
Demostration of palettes and animation in a Delphi component. Copyright © 1998 Tempest Software, Inc. The TMovingGradient component displays a color gradient, with a user-specified starting and ending color, and number of color steps between them. When Enabled, the gradient continually rotates, which has the effect of moving sideways. Set Enabled to False to stop the animation effect. Palette animation works only on displays that use a palette, namely, 256-color video adapters. One possible use for this "non-progress" bar is to show that a process is running but you don't know when it will finish.
Constructors |
Functions |
Properties |
Events |
Variables |
Constructors |
Create and initialize the control. Start with 64 steps because most palette devices use 18 bits per pixel, which means 6 bits per color, or 64 distinct colors. The colors blue and white look nice, but feel free to change them to whatever you find more aesthetic. Ditto for the default size.
Functions |
Animate the control by shifting the colors and then telling Windows to use the new colors.
Compute a color for the gradient.
Make a gradient palette and return the palette handle. Call this once when initializing the control. If the user changes the number of steps or the colors, recreate the palette with the new information.
Shift the colors to animate the palette. Just rotate all the colors in the palette by one step.
Propagate changes to the Enabled property to the timer, but at design time, leave the timer disabled.
Get the interval from the timer.
Propagate changes to the update interval to the timer.
Properties |
Events |
Variables |
Timer for animating the palette