怎样让水平滚动条中间的滚动框,在程序加载的时候出现在最左边。
怎样让水平滚动条中间的滚动框,在程序加载的时候出现在最左边。
由于我的树型控件的结点的名称比较长,我设置了有水平滚动条的样式。但是
程序一开始运行的时候滚动条中的滚动框就向右移了,没是在箭头旁边。
[解决办法]
HScrollBar 和 VScrollBar 控件(水平和垂直滚动条)-返回或设置滚动条的当前位置,其返回值始终介于 Max 和 Min 属性值之间,包括这两个值。
HScrollBar 和 VScrollBar 控件-设置介于 -32,768 与 32,767 之间的值以定位滚动框。
[解决办法]
sendmessage()
[解决办法]
WM_HSCROLL Notification
The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.
A window receives this message through its WindowProc function.
Syntax
WM_HSCROLL
WPARAM wParam
LPARAM lParam;
Parameters
wParam
The low-order word specifies a scroll bar value that indicates the user's scrolling request. This word can be one of the following values.
The high-order word specifies the current position of the scroll box if the low-order word is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, this word is not used.
SB_ENDSCROLL
Ends scroll.
SB_LEFT
Scrolls to the upper left.
SB_RIGHT
Scrolls to the lower right.
SB_LINELEFT
Scrolls left by one unit.
SB_LINERIGHT
Scrolls right by one unit.
SB_PAGELEFT
Scrolls left by the width of the window.
SB_PAGERIGHT
Scrolls right by the width of the window.
SB_THUMBPOSITION
The user has dragged the scroll box (thumb) and released the mouse button. The high-order word indicates the position of the scroll box at the end of the drag operation.
SB_THUMBTRACK
The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The high-order word indicates the position that the scroll box has been dragged to.
lParam
If the message is sent by a scroll bar, then this parameter is the handle to the scroll bar control. If the message is not sent by a scroll bar, this parameter is NULL.
Return Value
If an application processes this message, it should return zero.
Remarks
The SB_THUMBTRACK request code is typically used by applications that provide feedback as the user drags the scroll box.
If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function.
Note that the WM_HSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_HSCROLL (and WM_VSCROLL) for scroll position data have a practical maximum position value of 65,535.
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.
Notification Requirements
Minimum DLL Version None
Header Declared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1