How to change the progressbar's color in MFC

有些话、适合烂在心里 提交于 2019-12-24 14:34:22

问题


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.



来源:https://stackoverflow.com/questions/12235314/how-to-change-the-progressbars-color-in-mfc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!