문제

I am running the sample code from msdn.

// Turn the marquee animation on or off. 
void CCProgressCtrl_s1Dlg::OnSetmarqueeOn()
{
    m_progressCtrl.SetMarquee(TRUE, nMarqueeInterval);
}

void CCProgressCtrl_s1Dlg::OnSetmarqueeOff()
{
    m_progressCtrl.SetMarquee(FALSE, nMarqueeInterval);
}

This works but the problem is when marquee is off, the progress bar stays frozen at the instance. So if the moving light was in the middle at the time it will just freeze in that position. I want to reset the marquee when I turn it off but couldn't find any function for that. I tried SetPos(0) but that doesn't help either. Is there a way to reset the marquee progress bar once it has been sprang into action?

도움이 되었습니까?

해결책

You have to remove the ProgressBar's PBS_MARQUEE window style, such as with CWnd::ModifyStyle(), before you can then change the position to whatever value you want. Enable the PBS_MARQUEE style only when you are in marque mode, and disable it when not.

void CCProgressCtrl_s1Dlg::OnSetmarqueeOn()
{
    m_progressCtrl.ModifyStyle(0, PBS_MARQUEE);
    m_progressCtrl.SetMarquee(TRUE, nMarqueeInterval);
}

void CCProgressCtrl_s1Dlg::OnSetmarqueeOff()
{
    m_progressCtrl.SetMarquee(FALSE, nMarqueeInterval);
    m_progressCtrl.ModifyStyle(PBS_MARQUEE, 0);
    m_progressCtrl.SetPos(0);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top