Scroll Bar 控件

  • Structure
    •  1 typedef struct tagSCROLLINFO {
      2 UINT cbSize; //Sizeof(SCROLLINFO)
      3 UINT fMask;
      4 int nMin; //minimum scrolling position
      5 int nMax; //maximum scrolling position
      6 UINT nPage;
      7 int nPos; //position of the scroll box
      8 int nTrackPos;
      9 } SCROLLINFO;
      10 typedef SCROLLINFO FAR* LPSCROLLINFO;
    • fMask:需要设置或获取的参数。SIF_ALL、SIF_DISABLENOSCROLL、SIF_PAGE、SIF_POS、SIF_RANGE、SIF_TRACKPOS
    • nPage:页尺寸。用来设置scroll box的适当尺寸。
    • nTrackPos:拖动scroll box时的当前位置,对应SB_THUMBTRACK消息
  • Functions
    • BOOL GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi );
      int SetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw ); 
      int SetScrollPos(HWND hWnd, int nBar, int nPos, BOOL bRedraw ); 
      BOOL SetScrollRange(HWND hWnd, int nBar, int nMinPos, int nMaxPos, BOOL bRedraw ); 
      BOOL GetScrollInfo(HWND hwnd, int fnBar, LPSCROLLINFO lpsi ); 
      BOOL ScrollDC(
        HDC hDC, 
        int dx, 
        int dy, 
        const RECT* lprcScroll, 
        const RECT* lprcClip, 
        HRGN hrgnUpdate, 
        LPRECT lprcUpdate 
      ); 
      int ScrollWindowEx( 
        HWND hWnd, 
        int dx, 
        int dy, 
        const RECT* prcScroll, 
        const RECT* prcClip, 
        HRGN hrgnUpdate, 
        LPRECT prcUpdate, 
        UINT flags 
      ); 
  • Messages
    • WM_HSCROLL:nScrollCode、nPos、hwndScrollBar
    • WM_VSCROLL
posted @ 2011-09-24 12:02  iThinking  阅读(255)  评论(0编辑  收藏  举报