谢谢!Hi all,I have created a Progress control, and created [CProgressCtrl m_pro] by Wizard.I want to change the color of Progress Control so I added the code in CxxxDlg::OnInitDialog :COLORREF clrBar = RGB(255, 0, 0);m_pro.SendMessage(PBM_SETBARCOLOR, 0, (LPARAM) clrBar);But it's not working...The color was not change.Did I miss something(maybe the attribute of Progress Control)?Thanks for your help,thank you!推荐答案这是启用C ++ Visual-Styles的代码 $ b stdafx.h中的$ b:Here is the Code to enable Visual-Styles for C++in stdafx.h:#include <commctrl.h>#pragma comment (lib, "comctl32.lib ")// Ensure that version 6 of ComCtl32.dll is used:#pragma comment(linker, "\"/manifestdependency:type='win32'\name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")BOOL CMyApp::InitInstance(){ INITCOMMONCONTROLSEX CommonControls; CommonControls.dwSize = sizeof (INITCOMMONCONTROLSEX); CommonControls.dwICC = ICC_STANDARD_CLASSES; InitCommonControlsEx (&CommonControls); ... return TRUE;}您需要使用SendMessage API向进度条控件发送消息。 这是一个答案 [ ^ ]如何改变颜色。 第二次看它虽然它几乎与你正在做的一样,所以你可能需要添加这样的东西来禁用你的进度条的主题。你必须包括uxtheme.h和uxtheme.lib ...You need to send a message to the progressbar control using the SendMessage API. Here is an answer[^] on StackOverflow that shows pretty well how to change the color.On second look though its almost exactly the same that you are doing, so you may need to add something like this to disable themeing for your progress bar. You will have to include uxtheme.h and uxtheme.lib...SetWindowTheme(hwndProg, _T(""), _T("")); 其中 hwndProg 是进度条的HWND句柄。Where hwndProg is the HWND handle of your progress bar.不是100%肯定,但请查看与此相关的Application.EnableVisualStylesNot 100% sure, but check out Application.EnableVisualStyles with regards to this 这篇关于无法更改进度控制的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 09-01 19:03