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!
Printable View
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!
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
why not just use SB_LEFT instead of SB_LINELEFT - or am i missing something?
SB_LEFT will fire a "Large Change". If the node is a childnode, it will scroll the scrollbar beyond that node's icon.
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.