Color progress bar control :
---------------------------------------------
After adding the progress bar control and add the "control" member variable to the progress bar as m_ColorProgressbar
No need for the OnCtlColor() fn.
Progress bar control supports color without OnCtlColor() fn.
class CAppDialog : public CDialog
{
public:
virtual void OnOK();
afx_msg void OnTimer(UINT nIDEvent);
};
BEGIN_MESSAGE_MAP()
ON_WM_TIMER()
END_MESSAGE_MAP()
#define PROG_TIMER 2011
void CAppDialog::OnOK()
{
m_ColorProgressbar.SetRange(0,100);
COLORREF m_BackColor = RGB(255,255,255); //white
COLORREF m_BarColor = RGB(255,140,0); //Orange
m_ColorProgressbar.SendMessage(PBM_SETBKCOLOR,0,m_BackColor);
m_ColorProgressbar.SendMessage(PBM_SETBARCOLOR,0,m_BarColor);
SetTimer(PROG_TIMER,100,NULL);
}
void CAppDialog::OnTimer(UINT nIDEvent)
{
if(nIDEvent == PROG_TIMER)
{
m_ColorProgressbar.StepIt();
}
CDialog::OnTimer(nIDEvent);
}
Thursday, May 10, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment