我的问题是:如何检测滚动条是否位于 Richtextbox 的末尾?
编辑:当我说最后时,我的意思是完全滚动到底部,而不是其他地方。
最佳答案
查看 GetScrollRange
和 GetScrollPos
API...
Private Const SBS_HORZ = 0
Private Const SBS_VERT = 1
<DllImport("user32.dll")> _
Public Function GetScrollRange(ByVal hWnd As IntPtr, ByVal nBar As Integer, _
ByRef lpMinPos As Integer, _
ByRef lpMaxPos As Integer) As Boolean
End Function
<DllImport("user32.dll")> _
Public Function GetScrollPos(ByVal hWnd As Integer, _
ByVal nBar As Integer) As Integer
End Function
// ...
Dim scrollMin as Integer = 0
Dim scrollMax as Integer = 0
If(GetScrollRange(rtb.Handle, SBS_VERT, scrollMin, scrollMax) Then
Dim pos as Integer = GetScrollPos(rtb.Handle, SBS_VERT)
// Detect if they're at the bottom
EndIf
注释:
要确定滚动条是否可见,请调用 GetWindowLong
并检查 WS_VSCROLL
要确定 slider 可以达到的最大值,请调用 GetScrollInfo
;我认为最大值是
scrollMax - largeChange + 1
关于.net - 如何检测滚动条是否位于 Richtextbox 的末尾 (vb.net),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/656842/