Kumar
Kumar

Reputation: 636

Couldn't able to change mfc progress bar color

I am not able to change progress bar color to RED in my dialog box.

m_progress.SetBarColor(RGB(255,0,0));
m_progress.SendMessage(PBM_SETBARCOLOR, 0, (LPARAM) RGB(255,0,0));

The above both methods are not working. In MSDN site it was mentioned that, "using Vista themes will not allow to change progress bar color". But i am using Windows 7 themes. Then what could be the reason? Please enlighten me.

Upvotes: 0

Views: 755

Answers (2)

Sivaraman
Sivaraman

Reputation: 458

If you are using older version of C++ (MFC) runtime, then progress colour can be changed by sending message to the control.

The methods you tried above works for later releases of Visual studio. The article is doing exactly what you are expecting: Article Link

Upvotes: 0

Ajay
Ajay

Reputation: 18431

Windows 7 theme implies Windows Vista themes. You may want to use SetState with PBST_ERROR.

Upvotes: 1

Related Questions