راست به چپ کردن tree view
کد:
Option Explicit
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const WS_EX_LAYOUTRTL = &H400000
Private Const GWL_EXSTYLE = -20
'
Private Sub Form_Load()
SetWindowLong TreeView.hwnd, GWL_EXSTYLE, GetWindowLong(TreeView.hwnd, GWL_EXSTYLE) Or WS_EX_LAYOUTRTL
Dim nodX As Node
Set nodX = TreeView.Nodes.Add(, , "R", "Root")
nodX.Expanded = True
Set nodX = TreeView.Nodes.Add(, , "P", "Parent")
nodX.Expanded = True
Set nodX = TreeView.Nodes.Add("R", tvwChild, , "Child 1")
Set nodX = TreeView.Nodes.Add("R", tvwChild, , "Child 2")
Set nodX = TreeView.Nodes.Add("R", tvwChild, , "Child 3")
Set nodX = TreeView.Nodes.Add("P", tvwChild, , "Child 4")
Set nodX = TreeView.Nodes.Add("P", tvwChild, , "Child 5")
Set nodX = TreeView.Nodes.Add("P", tvwChild, , "Child 6")
End Sub