滚动条学习笔记

  • Post author:
  • Post category:其他


///一/

需要在CreateWindow的第三个参数中包括窗口样式(WS)标识符WS_VSCROLL(垂直卷动)和/或WS_HSCROLL(水平卷动)

SetScrollRange (hwnd, iBar, iMin, iMax, bRedraw) ;

(GetScrollRange和GetScrollPos)来取得滚动条的目前范围和位置。

Windows给窗口消息处理程序发送WM_VSCROLL(供上下移动)和WM_HSCROLL(供左右移动)消息。在滚动条上的每个鼠标动作都至少产生两个消息,一条在按下鼠标按钮时产生,一条在释放按钮时产生。

wParam的低字组是一个数值,它指出了鼠标对滚动条进行的操作。这个数值被看作一个「通知码」

define SB_LINEUP 0

define SB_LINELEFT 0

define SB_LINEDOWN 1

define SB_LINERIGHT 1

define SB_PAGEUP 2

define SB_PAGELEFT 2

define SB_PAGEDOWN 3

define SB_PAGERIGHT 3

define SB_THUMBPOSITION 4

define SB_THUMBTRACK 5

define SB_TOP 6

define SB_LEFT 6

define SB_BOTTOM 7

define SB_RIGHT 7

define SB_ENDSCROLL 8

SetScrollPos

///二/

SetScrollInfo (hwnd, iBar, &si, bRedraw) ;

GetScrollInfo (hwnd, iBar, &si) ;

typedef struct tagSCROLLINFO

{

UINT cbSize ;// 结构体的大小(字节)

UINT fMask ; // values to set or get

int nMin ; // minimum range value

int nMax ; // maximum range value

UINT nPage ; // page size

int nPos ; // current position

int nTrackPos ;// current tracking position

}

SCROLLINFO, * PSCROLLINFO ;



版权声明:本文为arbut原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。