如何代码控制控件dbgird的横向滚动条
1个回答
展开全部
水平滚动条向右滚动
dbgrid.perform(($0114,1,0);
水平滚动条向左滚动
dbgrid.perform(($0114,0,0);
垂直滚动条向下滚动
dbgrid.perform(($0115,1,0);
垂直滚动条向上滚动
dbgrid.perform(($0115,0,0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WM_HSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle of scroll bar
Parameters
nScrollCode
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:
Value Meaning
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
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 Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP Scrolls to the upper left.
nPos
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.
hwndScrollBar
Value of lParam. Identifies the control if WM_HSCROLL is sent by a scroll bar control. If WM_HSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.
Return Values
If an application processes this message, it should return zero.
Remarks
The SB_THUMBTRACK notification message 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 SetScrollPos, SetScrollRange, 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 GetScrollPos for a description of the technique and its limits.
dbgrid.perform(($0114,1,0);
水平滚动条向左滚动
dbgrid.perform(($0114,0,0);
垂直滚动条向下滚动
dbgrid.perform(($0115,1,0);
垂直滚动条向上滚动
dbgrid.perform(($0115,0,0);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WM_HSCROLL
nScrollCode = (int) LOWORD(wParam); // scroll bar value
nPos = (short int) HIWORD(wParam); // scroll box position
hwndScrollBar = (HWND) lParam; // handle of scroll bar
Parameters
nScrollCode
Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:
Value Meaning
SB_BOTTOM Scrolls to the lower right.
SB_ENDSCROLL Ends scroll.
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 Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP Scrolls to the upper left.
nPos
Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.
hwndScrollBar
Value of lParam. Identifies the control if WM_HSCROLL is sent by a scroll bar control. If WM_HSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.
Return Values
If an application processes this message, it should return zero.
Remarks
The SB_THUMBTRACK notification message 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 SetScrollPos, SetScrollRange, 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 GetScrollPos for a description of the technique and its limits.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询