查找窗口的滚动单位

发布于 2024-09-11 11:49:29 字数 232 浏览 9 评论 0原文

我正在尝试找到一种方法来计算滚动单位(当您单击滚动条中的向下箭头时屏幕向下移动的像素数)。 SB_LINEUP 的 msdn 文档说:

减少滚动框位置; 向数据顶部滚动 一个单位。在每种情况下,一个单位是 应用程序定义为 适合数据。

无论如何,我们是否可以找出给定窗口的 1 个滚动单元的值是多少?

任何帮助将不胜感激。 谢谢。

I'm trying to find a way to compute the scroll unit (num. of pixels the screen moves down when u click once on the down arrow in the scrollbar). The msdn documentation for SB_LINEUP says :

Decrements the scroll box position;
scrolls toward the top of the data by
one unit. In each case, a unit is
defined by the application as
appropriate for the data.

Is there anyway for us to find out what the value of 1 scroll unit is, for a given window??

Any help would be appreciated.
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

牵你手 2024-09-18 11:49:29

查看 SystemInformation.MouseWheelScrollLines属性:

MouseWheelScrollLines 属性指示默认情况下在具有滚动条的多行控件中要滚动的行数。相应的Platform SDK系统范围参数是SPI_GETWHEELSCROLLLINES和SPI_SETWHEELSCROLLLINES。有关系统范围参数的详细信息,请参阅 Platform SDK 文档中的“SystemParametersInfo”,网址为 http://msdn.microsoft.com .

Check out SystemInformation.MouseWheelScrollLines Property:

The MouseWheelScrollLines property indicates how many lines to scroll, by default, in a multi-line control that has a scroll bar. The corresponding Platform SDK system-wide parameters are SPI_GETWHEELSCROLLLINES and SPI_SETWHEELSCROLLLINES. For more information about system-wide parameters, see "SystemParametersInfo" in the Platform SDK documentation at http://msdn.microsoft.com.

白色秋天 2024-09-18 11:49:29

我已经找到了一个方法来找出它。供其他人将来参考:

hdc = GetDC (hwnd); 
    // Extract font dimensions from the text metrics. 
    GetTextMetrics (hdc, &tm); 
    int pixelCnt= tm.tmHeight + tm.tmExternalLeading;

参考:http:// msdn.microsoft.com/en-us/library/bb787531%28VS.85%29.aspx

I've found out a way to find it out. For future reference for others:

hdc = GetDC (hwnd); 
    // Extract font dimensions from the text metrics. 
    GetTextMetrics (hdc, &tm); 
    int pixelCnt= tm.tmHeight + tm.tmExternalLeading;

Ref: http://msdn.microsoft.com/en-us/library/bb787531%28VS.85%29.aspx

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