|
楼主 |
发表于 2020-3-22 10:15:01
|
显示全部楼层
BOOL CT6ttDlg::OnInitDialog()
{
.............
// TODO: Add extra initialization here
m_scrollBar.SetScrollRange(0,100);
return TRUE; // return TRUE unless you set the focus to a control
}
void CT6ttDlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
if (pScrollBar->GetDlgCtrlID()==IDC_SCROLLBAR1)
{
int nCurrentPos=pScrollBar->GetScrollPos();
TRACE("nCurrentPos=%d\n",nCurrentPos);
switch(nSBCode)
{
// case SB_THUMBTRACK:
case SB_THUMBPOSITION:
pScrollBar->SetScrollPos(nPos);
break;
case SB_LINEUP:
pScrollBar->SetScrollPos(nCurrentPos-1);
break;
case SB_LINEDOWN:
pScrollBar->SetScrollPos(nCurrentPos+1);
break;
case SB_PAGEUP:
pScrollBar->SetScrollPos(nCurrentPos-5);
break;
case SB_PAGEDOWN:
pScrollBar->SetScrollPos(nCurrentPos+5);
break;
}
}
CDialog::OnVScroll(nSBCode, nPos, pScrollBar);
}
|
|