the default color of the progressbar is blue(maybe),how to change the color of the progressbar?or even change the bkcolor of the mfc's controls
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Assuming that you are working with a CProgressCtrl
named progressBarCtrl
, have a try with:
COLORREF clrBar = RGB(0, 0, 0); // the bar color
progressBarCtrl.SendMessage(PBM_SETBARCOLOR, 0, (LPARAM) clrBar);
for background:
COLORREF clrBg = RGB(255, 255, 255); // the background color
progressBarCtrl.SendMessage(PBM_SETBKCOLOR, 0, (LPARAM) clrBg);
PMB_SETBARCOLOR and PBM_SETBKCOLOR are Windows messages for changing the color settings of progress bar controls.
By the way, there is a method SetBkColor
for CProgressCtrl
which can be used for background color.