MFC中怎样用progress control实现像xp启动一样的不断滚动的进度条?
1个回答
推荐于2016-09-27
展开全部
//当程序运行到一个地方
const int TIMER_ID=1;
SetTimer(TIMER_ID,200,NULL);
//程序继续运行,执行完某一段
//KillTimer(TIMER_ID);
int m_iProgress;
void CDlgDlg::OnTimer(UINT nIDEvent)
{
CDialog::OnTimer(nIDEvent);
if(m_iProgress<100)
{
m_iProgress+=20;
}
CProgressCtrl *pProgressCtrl = (CProgressCtrl*)this->GetDlgItem(IDC_PROGRESS1);
pProgressCtrl->SetPos(m_iProgress);
if(m_iProgress==100)
{
m_iProgress=0;
}
}
const int TIMER_ID=1;
SetTimer(TIMER_ID,200,NULL);
//程序继续运行,执行完某一段
//KillTimer(TIMER_ID);
int m_iProgress;
void CDlgDlg::OnTimer(UINT nIDEvent)
{
CDialog::OnTimer(nIDEvent);
if(m_iProgress<100)
{
m_iProgress+=20;
}
CProgressCtrl *pProgressCtrl = (CProgressCtrl*)this->GetDlgItem(IDC_PROGRESS1);
pProgressCtrl->SetPos(m_iProgress);
if(m_iProgress==100)
{
m_iProgress=0;
}
}
追问
不行,只能显示3格进度~
追答
应该是KillTimer之前,进度条不停地从0到100,你再调一下
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询