没有无用代码,每句代码都有意义,基于IPicture显示图片,效果高,并且兼顾了了闪烁和擦除背景。
switch (nSBCode)
{
case SB_THUMBTRACK:
{
nPostion = GetScrollPos (SB_VERT);
ScrollWindow(0, nPostion - nPos);
SetScrollPos (SB_VERT, nPos);
}
break;
case SB_LINELEFT:
{
nPostion = GetScrollPos (SB_VERT);
SetScrollPos (SB_VERT, nPostion - 1);
if (nPostion != 0) ScrollWindow (0, 1);
}
break;
case SB_LINERIGHT:
{
nPostion = GetScrollPos (SB_VERT);
SetScrollPos (SB_VERT, nPostion + 1);
if (nPostion + nThumbwidth < nMax) ScrollWindow (0, -1);
}
break;
case SB_PAGELEFT: //在滚动块的上方空白滚动区域单击,增量为6
{
SetScrollPos (SB_VERT, nPostion - 6);
if (nPostion+nThumbwidth > 0) ScrollWindow (0, 6);
}
break;
case SB_PAGERIGHT: //在滚动块的下方空白滚动区域单击,增量为6
{
SetScrollPos (SB_VERT, nPostion + 6);
if (nPostion+nThumbwidth < nMax) ScrollWindow (0, -6);
}
break;
}
1