开发者

SROLLBARINFO.rcScrollbar is referred to dimesion of scroll bar itself or scroll thumb

SCROLLBARINFO Struct
    cbSize DWORD 
    rcScrollBar RECT 
    dxyLineButton DWORD
    xyThumbTop DWORD 
    xyThumbBottom DWORD 
    reserved DWORD 
    rgstate DWORD 6 DUP 
SCR开发者_JS百科OLLBARINFO ends

When GetScrollBarInfo() return this structure, rcScrollBar is the dimension of scroll bar or scroll thumb?

Update:

Another structure from GetScrollInfo:

typedef struct tagSCROLLINFO {
  UINT cbSize;
  UINT fMask;
  int  nMin;
  int  nMax;
  UINT nPage;
  int  nPos;
  int  nTrackPos;
} SCROLLINFO, **LPCSCROLLINFO;

To detect whether the scroll thumb at the bottom, why this formula works:

IsAtBottom = (si.nMax - si.nPos) < (sbi.rcScrollBar.bottom - sbi.rcScrollBar.top)

What is the relationship between nMax, nPos and scrollbar rect?

Thanks in advance.


It's the coordinates (as a RECT, so top, left, right, bottom) of the scrollbar itself (see msdn). In order to get the dimensions you would need to perform the subtraction (code snippet is in C++ but you could translate to C#):

RECT coords = info.rcScollBar;
LONG width = coords.right - coords.left;
LONG height = coords.bottom - coords.top;

You will also want to be sure you are working in the correct coordinate system (screen or client). I was trying to find what coordinate system you get back from GetScrollBarInfo but haven't found it yet. My guess would be it is in client coordinates, but I cannot confirm this.


It's the dimensions of the scroll bar rather than the thumb.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜