功能:
很简单,就是通过手动,显示进度,并表示数值。
不同点:函数不同,原来的不能公用了,特别是滚动条,是另外一个控件,响应的消息也不是控件的,而是系统的那个WM_HScroll,函数也是对应的了。设置标度,等等,函数都要对应,其实查API也可以。
// TODO: Add extra initialization here
m_progress.SetRange(0,100);
m_progress.SetStep(5);
m_progress.SetPos(0);
m_edit = 0;
UpdateData(FALSE)

void CTest27Dlg::OnForward()


{
// TODO: Add your control notification handler code here
int nLow,nUp;
m_progress.GetRange(nLow,nUp);
int nPos = m_progress.GetPos();
if(((nPos+5)>nUp)&&((nPos)<=nUp))
nPos = 100;
else
nPos += 5;
m_progress.SetPos(nPos);
m_edit = nPos;
UpdateData(FALSE);
}

void CTest27Dlg::OnBackward()


{
// TODO: Add your control notification handler code here
int nLow,nUp;
m_progress.GetRange(nLow,nUp);
int nPos = m_progress.GetPos();
if(((nPos-5)<nLow)&&((nPos)>=nLow))
nPos = 0;
else
nPos -= 5;
m_progress.SetPos(nPos);
m_edit = nPos;
UpdateData(FALSE);
}

// TODO: Add extra initialization here
m_scroll.SetScrollRange(0,100);
m_scroll.SetScrollPos(10);
m_edit = 10;
UpdateData(FALSE);




void CTest28Dlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)


{
// TODO: Add your message handler code here and/or call default
int npos = m_scroll.GetScrollPos(); //此函数也是固定的模式

switch(nSBCode)
{ //选择模式,这个是由系统调用默认的
case SB_LINELEFT:
npos--;
break;
case SB_LINERIGHT:
npos++;
break;
case SB_PAGELEFT:
npos -= 10;
break;
case SB_PAGERIGHT:
npos += 10;
break;
case SB_THUMBTRACK:
npos = nPos;
break;
}
if(npos < 0)
nPos = 0;
if(npos > 100)
nPos = 100;
m_scroll.SetScrollPos(npos);
m_edit = npos;
UpdateData(FALSE);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}


posted on 2010-02-07 00:22
deercoder 阅读(404)
评论(0) 编辑 收藏 引用