网站首页  词典首页

请输入您要查询的函数:

 

术语 setscrollrange
释义 SetScrollRange
语法:
BOOL SetScrollRange( HWND hWnd,
int nBar,
int nMinPos,
int nMaxPos,
BOOL bRedraw
);
SetScrollRange功能
该SetScrollRange函数设置指定的滚动条的最低和最高滚动框位置。
注意SetScrollRange函数是为了向后兼容。新的应用程序应该使用SetScrollInfo函数。
参数
hWnd
[in]句柄滚动条控制或与一个标准的滚动条的窗口,这取决于该nBar参数的值。
nBar
[in]指定滚动条被设置。此参数可以是下列值之一。
SB_CTL
设置滚动条控制范围。在hwnd参数必须处理的滚动条控制。
SB_HORZ
设置窗口的标准Level滚动条的范围。
SB_VERT
设置窗口的标准垂直滚动条的范围。
nMinPos
[in]指定的最低滚动位置。
nMaxPos
[in]指定最大滚动位置。
bRedraw
[in]指定滚动条是否应该重新划分,以反映这种变化。如果此参数为TRUE,滚动条的重绘。如果是FALSE,则滚动条不重新划分。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。
备注
您可以使用SetScrollRange隐藏设置nMinPos和相同的值nMaxPos滚动条。应用程序不应调用SetScrollRange函数隐藏在处理滚动条滚动条消息。新的应用程序应该使用ShowScrollBar函数隐藏滚动条。
如果对SetScrollRange立即打电话遵循调用SetScrollPos功能,在SetScrollPos bRedraw参数必须是零,以防止滚动条被拉两次。
对于一个标准的滚动条默认范围是0到100。对于一个滚动条控件的默认范围是空的(无论是nMinPos和nMaxPos参数值为零)。之间的nMinPos和nMaxPos参数指定的值的差异不能大于MAXLONG价值。
由于消息,以表明滚动条的位置,WM_HSCROLL和WM_VSCROLL,被限制为16个位置的数据,应用依赖状况的数据,这些信息仅仅有1位为65,535为SetScrollRange函数的nMaxPos参数实用的最大值。
但是,由于SetScrollInfo,SetScrollPos,SetScrollRange,GetScrollInfo,GetScrollPos和GetScrollRange功能,支持32位的滚动条位置数据,有一种方法可以绕过16位的WM_HSCROLL和WM_VSCROLL消息的障碍。请参阅该技术的描述GetScrollInfo。
如果nBar参数SB_CTL和hWnd参数指定的窗口不是一个滚动条控制系统,该系统发送SBM_SETRANGE信息,窗口设置滚动条信息。这使得SetScrollRange运作自定义控件模仿一个滚动条。如果窗口不处理SBM_SETRANGE消息,SetScrollRange函数失败。
例如
有关示例,请参阅使用所有者显示剪贴板格式。
功能信息
最低DLL版本 user32.dll
在Winuser.h中HeaderDeclared,头文件:winuser.h
import libraryUser32.lib
最低操作系统Windows 95,Windows NT 3.1
参见
GetScrollInfo,GetScrollPos,GetScrollRange,SetScrollInfo,SetScrollPos,ShowScrollBar
==英文原文==SetScrollRange Function
The SetScrollRange function sets the minimum and maximum scroll box positions for the specified scroll bar.
Note The SetScrollRange function is provided for backward compatibility. New applications should use the SetScrollInfo function.
Syntax
BOOL SetScrollRange( HWND hWnd,
int nBar,
int nMinPos,
int nMaxPos,
BOOL bRedraw
);
Parameters
hWnd
[in] Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the nBar parameter.
nBar
[in] Specifies the scroll bar to be set. This parameter can be one of the following values.
SB_CTL
Sets the range of a scroll bar control. The hwnd parameter must be the handle to the scroll bar control.
SB_HORZ
Sets the range of a window's standard horizontal scroll bar.
SB_VERT
Sets the range of a window's standard vertical scroll bar.
nMinPos
[in] Specifies the minimum scrolling position.
nMaxPos
[in] Specifies the maximum scrolling position.
bRedraw
[in] Specifies whether the scroll bar should be redrawn to reflect the change. If this parameter is TRUE, the scroll bar is redrawn. If it is FALSE, the scroll bar is not redrawn.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError .
Remarks
You can use SetScrollRange to hide the scroll bar by setting nMinPos and nMaxPos to the same value. An application should not call the SetScrollRange function to hide a scroll bar while processing a scroll bar message. New applications should use the ShowScrollBar function to hide the scroll bar.
If the call to SetScrollRange immediately follows a call to the SetScrollPos function, the bRedraw parameter in SetScrollPos must be zero to prevent the scroll bar from being drawn twice.
The default range for a standard scroll bar is 0 through 100. The default range for a scroll bar control is empty (both the nMinPos and nMaxPos parameter values are zero). The difference between the values specified by the nMinPos and nMaxPos parameters must not be greater than the value of MAXLONG.
Because the messages that indicate scroll bar position, WM_HSCROLL and WM_VSCROLL , are limited to 16 bits of position data, applications that rely solely on those messages for position data have a practical maximum value of 65,535 for the SetScrollRange function's nMaxPos parameter.
However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo , GetScrollPos , and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique.
If the nBar parameter is SB_CTL and the window specified by the hWnd parameter is not a system scroll bar control, the system sends the SBM_SETRANGE message to the window to set scroll bar information. This allows SetScrollRange to operate on a custom control that mimics a scroll bar. If the window does not handle the SBM_SETRANGE message, the SetScrollRange function fails.
Example
For an example, see Using the Owner Display Clipboard Format .
Function Information
Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systemsWindows 95, Windows NT 3.1
See Also
GetScrollInfo , GetScrollPos , GetScrollRange , SetScrollInfo , SetScrollPos , ShowScrollBar
==原始网址==http://msdn.microsoft.com/en-us/library/bb787599(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:25:50