Click here to Skip to main content
15,886,919 members
Articles / Desktop Programming / MFC
Article

Pie Progress Control

Rate me:
Please Sign up or sign in to vote.
2.78/5 (3 votes)
22 Aug 2000 75.1K   2K   19   7
A progress control with a difference
  • Download source files - 4 Kb
  • Download demo project - 32 Kb
  • Sample Image - piectrl.jpg

    Introduction

    This article shows the use of a pie progress control. The code is encapsulated in a MFC class. The class itself is derived from a CStatic class. The code demonstrates the how perform flicker free drawing. The control works in a similar way to the standard Windows progress control.

    The main core of the code is in the drawing routine (OnPaint).

    The public interface to access the class is shown here...

    void SetTextColor(COLORREF crColor);
    void SetBkColor(COLORREF crColor);
    void SetPieOutlineColor(COLORREF crColor);
    void ShowText(BOOL bText);
    void SetStep(int nStep);
    void GetRange(int& nLower, int& nUpper);
    void SetRange(int nLower, int nUpper);
    void PieOutlineColorEnable(BOOL bState);
    int StepIt();
    int OffsetPos(int nOffset);
    int GetPos();
    int SetPos(int nPos);

    The class is created with the window default Create() member. The control can be any shape or size. The example code also shows how to add a client edge to the window.

    The next version will allow:

    • Text orientation and sizing.
    • Gradient coloring.
    • Optional background bitmap.
    • Jaggies removed.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here


    Written By
    Software Developer (Senior) Software Kinetics
    United Kingdom United Kingdom




    Software Kinetics
    are experts in developing customised and bespoke applications and have expertise in the development of desktop, mobile and internet applications on Windows.


    We specialise in:

    • User Interface Design
    • Desktop Development
    • Windows Phone Development
    • Windows Presentation Framework
    • Windows Forms
    • Windows Communication Framework
    • Windows Services
    • Network Applications
    • Database Applications
    • Web Development
    • Web Services
    • Silverlight
    • ASP.net


    Visit Software Kinetics

    Comments and Discussions

     
    Generaltake a look @ this Pin
    eRRaTuM9-Jun-05 23:36
    eRRaTuM9-Jun-05 23:36 
    GeneralRe: take a look @ this Pin
    NormDroid9-Jun-05 23:47
    professionalNormDroid9-Jun-05 23:47 
    Generalexe problem Pin
    salah_gis18-Dec-02 0:28
    salah_gis18-Dec-02 0:28 
    GeneralDll question Pin
    salah_gis18-Dec-02 0:26
    salah_gis18-Dec-02 0:26 
    Generallets add more to it Pin
    Ashok Jaiswal9-Apr-02 8:19
    Ashok Jaiswal9-Apr-02 8:19 
    hi,
    this pie control works just perfect but i thought to make some additions to it e.g. ability to skin the contol.

    for this i created the following function

    SetSkin(short nCursor, short nImageComplete, short nImageIncomplete);

    now i loaded these images which are full circles of 2 different colors with their background of certain color so that they can be painted tranparently.

    now in the approach i took, i draw the background image in the OnPaint and then the incomplete image in memory. Over this incomplete image i draw i pie using the standard Pie funtion and then i try to make the pei potion transparent so that the incomplete image is drawn over the background image.

    but i could't do that ( i just don know why my mind does't work, i tried to mask the potion drawn by pie function )

    can you help me it.
    (im not registered on the site yet so if u reply to this message pls let me know at aero_priest@hotmail.com)

    thanks n cheers
    les keep the good work goingRoll eyes | :rolleyes: Cry | :(( Frown | :(

    ashok
    GeneralRe: lets add more to it Pin
    NormDroid9-Apr-02 22:31
    professionalNormDroid9-Apr-02 22:31 
    GeneralRe: lets add more to it Pin
    Ashok Jaiswal9-Apr-02 23:06
    Ashok Jaiswal9-Apr-02 23:06 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.