1个回答
展开全部
滚动条必须处理-_-!(不能偷懒)如下↓:
SetScrollRange(hDlg,SB_VERT,0,40,FALSE); // 多少行
SetScrollPos(hDlg, SB_VERT,0,TRUE); //起点行
其实就一个CASE
case WM_VSCROLL:
{
switch(LOWORD(wParam))
{
case SB_LINEDOWN: //通知码
nVScrollPos ++; //向下
break;
case SB_LINEUP:
nVScrollPos --;//向上
break;
}
if(nVScrollPos<0) // 。。。。。。。。。
nVScrollPos = 0;
else if(nVScrollPos>40)
nVScrollPos = 40;
SCROLLINFO si; // 又一结构体
===================================SCROLLINFO=====================================
typedef struct tagSCROLLINFO {
UINT cbSize; -- Specifies the size, in bytes, of this structure.
UINT fMask; -- Specifies the scroll bar parameters to set or retrieve(有6个参数类型)
int nMin; -- Specifies the minimum scrolling position
int nMax; -- Specifies the maximum scrolling position.
UINT nPage; -- Specifies the page size
int nPos; -- Specifies the position of the scroll box
int nTrackPos; -- Specifies the immediate position of a scroll box that the user is dragging.
} SCROLLINFO;
====================================================================================
ZeroMemory(&si, sizeof(SCROLLINFO));
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_TRACKPOS;
// Call GetScrollInfo to get current tracking
// position in si.nTrackPos
if (!GetScrollInfo(hDlg, SB_VERT, &si) )
break;
if(nVScrollPos!= si.nPos)
{
SetScrollPos(hDlg, SB_VERT,nVScrollPos,TRUE);
InvalidateRect(hDlg,NULL,TRUE); ============repaint
}
break;
}
SetScrollRange(hDlg,SB_VERT,0,40,FALSE); // 多少行
SetScrollPos(hDlg, SB_VERT,0,TRUE); //起点行
其实就一个CASE
case WM_VSCROLL:
{
switch(LOWORD(wParam))
{
case SB_LINEDOWN: //通知码
nVScrollPos ++; //向下
break;
case SB_LINEUP:
nVScrollPos --;//向上
break;
}
if(nVScrollPos<0) // 。。。。。。。。。
nVScrollPos = 0;
else if(nVScrollPos>40)
nVScrollPos = 40;
SCROLLINFO si; // 又一结构体
===================================SCROLLINFO=====================================
typedef struct tagSCROLLINFO {
UINT cbSize; -- Specifies the size, in bytes, of this structure.
UINT fMask; -- Specifies the scroll bar parameters to set or retrieve(有6个参数类型)
int nMin; -- Specifies the minimum scrolling position
int nMax; -- Specifies the maximum scrolling position.
UINT nPage; -- Specifies the page size
int nPos; -- Specifies the position of the scroll box
int nTrackPos; -- Specifies the immediate position of a scroll box that the user is dragging.
} SCROLLINFO;
====================================================================================
ZeroMemory(&si, sizeof(SCROLLINFO));
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_TRACKPOS;
// Call GetScrollInfo to get current tracking
// position in si.nTrackPos
if (!GetScrollInfo(hDlg, SB_VERT, &si) )
break;
if(nVScrollPos!= si.nPos)
{
SetScrollPos(hDlg, SB_VERT,nVScrollPos,TRUE);
InvalidateRect(hDlg,NULL,TRUE); ============repaint
}
break;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询