-
December 13th, 2019, 03:47 AM
#1
Changing color of CProgressBarCtrl in MFC C++
I have used following code for coloring the CProgressBarCtrl:
Code:
COLORREF clrBar = RGB(0, 0, 0); // the bar color
progressBarCtrl.SendMessage(PBM_SETBARCOLOR, 0, (LPARAM) clrBar);
But this is not working,instead i am getting windows dark blue color on CProgressBarCtrl
Last edited by 2kaud; December 13th, 2019 at 04:23 AM.
Reason: Fixed code tags - use [] and not <>
-
December 15th, 2019, 12:53 PM
#2
Re: Changing color of CProgressBarCtrl in MFC C++
Perhaps must be activated the application theme ... your app is UNICODE ? Take a look inside stdafx.h and see if this code is active:
Code:
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
-
December 15th, 2019, 04:36 PM
#3
Re: Changing color of CProgressBarCtrl in MFC C++
Since you are using MFC, why not use the MFC CProgressBarCtrl methods instead of using the non-MFC ::SendMessage?
-
December 16th, 2019, 01:56 AM
#4
Re: Changing color of CProgressBarCtrl in MFC C++
I checked stdafx.h ,code you wrote above is not there
-
December 16th, 2019, 02:04 AM
#5
Re: Changing color of CProgressBarCtrl in MFC C++
Made a MFC test project (SDI or MDI) with VS wizard and you'll see what I am talking about (take a look inside stdafx.h as I said in previous post).
Last edited by mesajflaviu; December 16th, 2019 at 12:41 PM.
-
February 4th, 2020, 02:56 AM
#6
Re: Changing color of CProgressBarCtrl in MFC C++
As Arjay said, you can directly use methods on the CProgressBarCtrl. See MSDN: https://docs.microsoft.com/en-us/cpp...s?view=vs-2019
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|