Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1072
  • Last Modified:

Owner draw CProgressCtrl

How do you create an owner draw CProgressCtrl (or change the regular CProgressCtrl) control that will display it's bar in different colors according to the input valuse it receives ? (i.e. the first part of it will be green, then yellow, and finally red)
0
ultguide
Asked:
ultguide
1 Solution
 
doronhCommented:
The easiest way to do this is to derive a class from CProgressCtrl and override the OnPaint function (use ClassWizard to this).  In the CDialog derived class, add a member of the derived CProgressCtrl.  In OnInitDialog (use class Wizard to add it (WM_INITDIALOG is the message)), call
CProgressCtrl::SubclassDlgItem(...).  It might be easier to show the progress as a full bar rather than the mini rectangles that the standard control uses.

The color of the progress bar is determined by the selection color that is set in the user settings.

doron
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now