-
December 22nd, 2011, 07:54 AM
#1
Listview auto-scroll vertically
I have this code:
Code:
Private Sub DragDropListView_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
If KeyItem Is Nothing Then
If tmrLVScroll.Enabled Then tmrLVScroll.Enabled = False
Return
End If
Cursor = Cursors.Hand
Dim HeaderOffset As Integer
If Me.View = Windows.Forms.View.Details Then HeaderOffset = Me.TopItem.GetBounds(ItemBoundsPortion.Entire).Top
If e.Y <= HeaderOffset + Me.Font.Height / 1.5 Then
intScrollDirection = 0
tmrLVScroll.Enabled = True
ElseIf e.Y >= Me.ClientSize.Height - Me.Font.Height / 1.5 Then
intScrollDirection = 1
tmrLVScroll.Enabled = True
Else
tmrLVScroll.Enabled = False
End If
Dim lastItemBottom As Integer = GetLastItemBottom(e)
Dim PosX As Integer
If Me.View = Windows.Forms.View.Details Then PosX = 0 Else PosX = e.X
Dim itemOver As ListViewItem = Me.GetItemAt(PosX, lastItemBottom)
If itemOver Is Nothing Then Return
If itemOver.Index < _ReorderStartIndex Then
If Me.Items.Count <= _ReorderStartIndex Then
itemOver = Nothing
Return
Else
itemOver = Me.Items(_ReorderStartIndex)
End If
End If
If e.Y < itemOver.Bounds.Top + itemOver.Bounds.Height / 2 Then
Me.LineBefore = itemOver.Index
Me.LineAfter = -1
Else
Me.LineBefore = -1
Me.LineAfter = itemOver.Index
End If
Me.Invalidate()
End Sub
but I can't get it to auto scroll vertically for largeicon, smallicon, and tile listviews. Can someone shed some light on this. Also, is there a much simpler way of doing it?
-
December 22nd, 2011, 10:39 AM
#2
Re: Listview auto-scroll vertically
It looks like you are trying to do it the hard way.
Have you tried just moving to the newly added item?
Always use [code][/code] tags when posting code.
-
December 22nd, 2011, 09:00 PM
#3
Re: Listview auto-scroll vertically
-
December 22nd, 2011, 10:23 PM
#4
Re: Listview auto-scroll vertically
Try the EnsureVisible() method
Always use [code][/code] tags when posting code.
-
December 28th, 2011, 10:10 PM
#5
Re: Listview auto-scroll vertically
I tried that to no avail. What I need to do is convert the horizontal lines that are drawn into to vertical ones.
-
December 28th, 2011, 10:19 PM
#6
Re: Listview auto-scroll vertically
I'm not sure what you are saying, if you are talking about getting these views to display in a single column I know of no way to do so.
Insurevisible will cause the list to scroll down to a point where the selected item is visible on screen.
I have tested this and it worked fine.
Always use [code][/code] tags when posting code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|