This article was contributed by V. Lakshmi Narasimhan.
Environment: Visual C++ 6 (SP2), Windows 98
I got the hunch from Netscape's progress control in the status bar. Since most of the complexity is hidden in the implementation, using this is as easy as using a normal progress bar. This control is not derived from CProgressBarctrl but from CStatic to ensure simplicity and efficiency. An imitation of Netscape status bar as well as a dialog based demo like that of CGradientProgress is included in the sample zip file. If this control is used in a dialog box, simply put a CStatic Place holder in the dialog and subclass it to CEZSnakeCtrl. Now you can customize the look & feel of the control. Various options available are:
//Get & Set The Maximum value of the progress control //0 is assumed as the minimum. int GetMax(); void SetMax(int nMax); //Get & Set the size of the snake int GetSize(); void SetSize(int nSize); //Get & Set the the Steps ->unit increment int GetStep(); void SetStep(int nStep); //Get The Head Position int GetPos(); //Get The tail position int GetTail(); //Get the direction of the snake BOOL IsReverse(); //Get & Set the Gradient begin & end colors COLORREF GetGradientEndColor(); COLORREF GetGradientStartColor(); void SetGradientFill(COLORREF clrStart,COLORREF clrEnd); //Get & Set Background color COLORREF GetBkColor(); void SetBkColor(COLORREF clrFG); //Operations<>BR int StepIt();//Move the snake. void ResetProgress();//reset the snake
I think the demo project can do rest of the explaining.
Add Comment
INSTANT EXPERTS!Savvy IT Pros report on SupportSource. Take a look inside the largest vault of multi-vendor computing specs ever assembled. Click here for an In-depth Report,. Learn about Free & Open Source software at the Bazaar Conference & Expo!,December 14-16, 1999 in New York City! Click here for more information. For tons of Windows technology resources, check out the Windows Programming directory. Go to Fatbrain for the NEWEST and BEST technical books for IT professionals. Get Linux Utilities for ONLY $34.95 at EarthWeb Direct.