SROLLBARINFO.rcScrollbar 是指滚动条本身或滚动滑块的尺寸
SCROLLBARINFO Struct
cbSize DWORD
rcScrollBar RECT
dxyLineButton DWORD
xyThumbTop DWORD
xyThumbBottom DWORD
reserved DWORD
rgstate DWORD 6 DUP
SCROLLBARINFO ends
当GetScrollBarInfo()返回该结构时,rcScrollBar是滚动条或滚动滑块的尺寸?
更新:
GetScrollInfo的另一个结构:
typedef struct tagSCROLLINFO {
UINT cbSize;
UINT fMask;
int nMin;
int nMax;
UINT nPage;
int nPos;
int nTrackPos;
} SCROLLINFO, **LPCSCROLLINFO;
为了检测滚动滑块是否在底部,为什么这个公式有效:
IsAtBottom = (si.nMax - si.nPos) IsAtBottom = (si.nMax - si.nPos) IsAtBottom = (si.nMax - si.nPos) (sbi.rcScrollBar.bottom - sbi.rcScrollBar.top)
nMax、nPos 和滚动条矩形之间有什么关系?
提前致谢。
SCROLLBARINFO Struct
cbSize DWORD
rcScrollBar RECT
dxyLineButton DWORD
xyThumbTop DWORD
xyThumbBottom DWORD
reserved DWORD
rgstate DWORD 6 DUP
SCROLLBARINFO 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是坐标(作为 RECT ,所以滚动条本身的上、左、右、下)(参见 msdn)。为了获得尺寸,您需要执行减法(代码片段是 C++ 语言,但您可以转换为 C#):
您还需要确保在正确的坐标系(屏幕或客户端)中工作。我试图找到从
GetScrollBarInfo
返回的坐标系,但尚未找到。我的猜测是它在客户端坐标中,但我无法确认这一点。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#):
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.