|
-
Aug 31st, 2006, 03:22 AM
#1
Thread Starter
New Member
TreeView Autoscroll
If the text of the node is very long,ensure visible property scrolls the treeview to the right most horizontally.
While autoscrolling i want the image to be visible.Can this be done???
Plzz help!
-
Aug 31st, 2006, 06:42 AM
#2
Re: TreeView Autoscroll
Try this:
VB Code:
Option Explicit
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByRef lParam As Any) As Long
Private Const WM_HSCROLL As Long = &H114
Private Const SB_LINELEFT As Long = 0
'------------------------------------------------------------------
Private Sub Command1_Click()
Dim i As Long
TreeView1.Nodes("[color=maroon]Key[/color]").EnsureVisible
For i = 1 To 4 'Scroll left 4 times to bring the icon into view
SendMessage TreeView1.hwnd, WM_HSCROLL, SB_LINELEFT, 0&
Next i
End Sub
-
Aug 31st, 2006, 06:48 AM
#3
Re: TreeView Autoscroll
why not just use SB_LEFT instead of SB_LINELEFT - or am i missing something?
-
Aug 31st, 2006, 06:51 AM
#4
Re: TreeView Autoscroll
SB_LEFT will fire a "Large Change". If the node is a childnode, it will scroll the scrollbar beyond that node's icon.
-
Aug 31st, 2006, 06:56 AM
#5
Re: TreeView Autoscroll
BTW, using TVM_GETITEMRECT may be the best way to do this. (haven't tried it though)
But using SB_LINELEFT is easier.
If you are interested, see the StartLabelEdit Sub.
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
|