SROLLBARINFO.rcScrollbar 是指滚动条本身或滚动滑块的尺寸

发布于 2024-12-06 23:44:15 字数 832 浏览 2 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

空心↖ 2024-12-13 23:44:15

这是坐标(作为 RECT ,所以滚动条本身的上、左、右、下)(参见 msdn)。为了获得尺寸,您需要执行减法(代码片段是 C++ 语言,但您可以转换为 C#):

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

您还需要确保在正确的坐标系(屏幕或客户端)中工作。我试图找到从 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#):

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.

向地狱狂奔 2024-12-13 23:44:15

这是滚动条的尺寸而不是拇指的尺寸。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文