使用表单 VB.Net 的滚动条将列表视图 Up/Down 移动到表单
Move a listview Up/Down a form using the scrollbar of the Form VB.Net
我的表单包含一个 Treeview,我希望 Treeview 可以随着滚动条在表单中上下移动。
这是表格的屏幕截图。
可以在左侧看到 TreeView
我没有任何关于此的示例代码,因为我不确定从哪里开始
非常感谢任何帮助
谢谢
我对该主题进行了一些研究并找到了解决方案。
就把它留在这里给其他有同样问题的人吧。
'======================================
'TreeView Location Change with Scroll
Private Sub Form2_Scroll(sender As Object, e As ScrollEventArgs) Handles MyBase.Scroll
'Gets the vertical scroll values as an Integer
Dim verticalscroll As Integer = AutoScrollPosition.Y * -1
'Moves the Treeview to new location
EstimTree.Location = New Point(5, verticalscroll)
'If statement to contain the treeview within my form
If EstimTree.Location.Y <= 130 Then
EstimTree.Location = New Point(5, 130)
End If
End Sub
我的表单包含一个 Treeview,我希望 Treeview 可以随着滚动条在表单中上下移动。
这是表格的屏幕截图。 可以在左侧看到 TreeView
我没有任何关于此的示例代码,因为我不确定从哪里开始
非常感谢任何帮助 谢谢
我对该主题进行了一些研究并找到了解决方案。 就把它留在这里给其他有同样问题的人吧。
'======================================
'TreeView Location Change with Scroll
Private Sub Form2_Scroll(sender As Object, e As ScrollEventArgs) Handles MyBase.Scroll
'Gets the vertical scroll values as an Integer
Dim verticalscroll As Integer = AutoScrollPosition.Y * -1
'Moves the Treeview to new location
EstimTree.Location = New Point(5, verticalscroll)
'If statement to contain the treeview within my form
If EstimTree.Location.Y <= 130 Then
EstimTree.Location = New Point(5, 130)
End If
End Sub