vb滚动条有两种改变滚动条移动速度的属性:largechange
smallchange
largechange
当用户单击滚动条上的滑动箭头和滚动滑块之间的区域时,value
属性值的该变量。
smallchange
当用户单击滚动箭头时value属性值的改变量。
两者都可以在属性窗口更改也可以在编程时设置,
比如Hscroll1Smallchange
=
2
或者
Hscroll1Largechange
=
2
1、插入文本框
2、在文本框上点右键选属性
3、设置如下参数
MultiLine = True(多来行显示,不设此项回源车不按行)
ScrollBars = 3 - fmScrollBarsBoth(滚动条,百3是水平垂直滚动条都有)
WordWrap = False(自动换行,不改此项不会出现水平滚动条,因为换行了)
4、关闭设计模式(度就是在设计模式按钮上点一下)
OK了。
水平滚动条向右滚动
dbgridperform(($0114,1,0);
水平滚动条向左滚动
dbgridperform(($0114,0,0);
垂直滚动条向下滚动
dbgridperform(($0115,1,0);
垂直滚动条向上滚动
dbgridperform(($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
画一个Picture1、VScroll1、HScroll1,再在Picture1里画一个Image1。将Image1的Stretch设为False,AutoSize(如果有这个属性的话)设为True,Left、Top都设为0,要放到Image1中。将VScroll1、HScroll1的Min都设为0。
在Form_Load中打
VScroll1Max = Image1Height - Picture1ScaleHeight
HScroll1Max = Image1Width - Picture1ScaleWidth
在VScroll1的Scroll中打
Image1Top = 0 - VScroll1Value
在HScroll1的Scroll中打
Image1Left = 0 - HScroll1Value
最后要注意以上代码要求Image1中的大小必须超过Picture1所能显示的范围,而且Image1中的不宜过大,否则会报错。
QTableWidget控件可以通过两个函数内部的滚动条控件
QScrollBar verticalScrollBar() const 获得垂直滚动条控件
QScrollBar horizontalScrollBar() const 获得水平滚动条控件
滚动条控件是QScrollBar类型;
通过滚动条控件的void setValue(int)函数,可以修改滚动条的滚动位置。
注意QScrollBar的滚动位置不要超过minimum()和maximum()的范围。
1、在html中定义好一个dom标签,可以是body或者div等等。
2、给dom元素设置相应的宽度,可以用style中的width。
3、再给dom元素设置overflow属性,水平滚动条就是overflow-x:scroll。这样当元素中的内容超出设置的宽度时就会出现滚动条。
示例:
<div style="overflow-x:scroll;width:200px;white-space:nowrap;">当内容超出设定的宽度时自动出现横向滚动条</div>
ScrollView用代码设置滚动条,通过都会设置为隐藏,实现ScrollView滚动条的隐藏,有两种方法:
一种是在XML的ScrollView布局中加入属性android:scrollbars="none"
另一种则是在代码中获取ScrollView后进行scrollsetVerticalScrollBarEnabled(false);
欢迎分享,转载请注明来源:表白网
评论列表(0条)