标签:mfc progress bar
写一个格斗游戏,想用CProgressCtrl作血条和魔法条,需要设置颜色,网上找到2种本质一样的方法:
// 创建进度条 m_leftHp.Create(WS_CHILD | WS_VISIBLE | PBS_SMOOTH, CRect(80, 20, 400, 45), this, 123);
m_leftHp.SendMessage(PBM_SETBKCOLOR, 0, RGB(10, 10, 10));
m_leftHp.SetBarColor(RGB(255, 0, 0));
// Set the progress bar color to red, green, blue, or // the system default. The SetBarColor method has an // effect only if the Windows system theme is Classic.
// 使用带主题的控件 //#if defined _M_IA64 // 安腾平台 //#pragma comment(linker, "/MANIFESTDEPENDENCY:" //"\"type='Win32' " //"name='Microsoft.Windows.Common-Controls' version='6.0.0.0' " //"processorArchitecture='IA64' " //"publicKeyToken='6595B64144CCF1DF'\"") //#elif defined _M_AMD64 // 64位平台 //#pragma comment(linker, "/MANIFESTDEPENDENCY:" //"\"type='Win32' " //"name='Microsoft.Windows.Common-Controls' version='6.0.0.0' " //"processorArchitecture='AMD64' " //"publicKeyToken='6595B64144CCF1DF'\"") //#elif defined _M_IX86 // 32位平台 //#pragma comment(linker, "/MANIFESTDEPENDENCY:" //"\"type='Win32' " //"name='Microsoft.Windows.Common-Controls' version='6.0.0.0' " //"processorArchitecture='X86' " //"publicKeyToken='6595B64144CCF1DF'\"") //#elif defined _M_ARM // ARM平台 //#pragma comment(linker, "/MANIFESTDEPENDENCY:" //"\"type='Win32' " //"name='Microsoft.Windows.Common-Controls' version='6.0.0.0' " //"processorArchitecture='ARM' " //"publicKeyToken='6595B64144CCF1DF'\"") //#else // 其它平台 //#pragma comment(linker, "/MANIFESTDEPENDENCY:" //"\"type='Win32' " //"name='Microsoft.Windows.Common-Controls' version='6.0.0.0' " //"processorArchitecture='*' " //"publicKeyToken='6595B64144CCF1DF'\"") //#endif // MANIFEST
可是……如何在不改变风格的情况下设置进度条颜色呢?我还没找到答案……
CProgressCtrl::SetBarColor无效的缘由,布布扣,bubuko.com
CProgressCtrl::SetBarColor无效的缘由
标签:mfc progress bar
原文地址:http://blog.csdn.net/npu_wy/article/details/30224963