473,320 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to change the TreeView nods alignment to right-to-left?

Hi guys,

I am using MS Access VBA and could download a sample TreeView which is nice. I only need to change the nods and childs alignment to right-to-left. (My Language is Persian)

I appreciate your kind help.
Feb 3 '11 #1
2 6246
ADezii
8,834 Expert 8TB
I do believe that there is no way to right-align Nodes in a treeView Control. What you can do is to experiment with the Indentation Property of the TreeView Control as in:
Expand|Select|Wrap|Line Numbers
  1. Me![TreeView1].Indentation = 1000
Feb 5 '11 #2
Hi
Create a module and declare the following APIs
Expand|Select|Wrap|Line Numbers
  1. Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
  2. Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
  3. Public Declare Function InvalidateRect Lib "user32" (ByVal hwnd As Long, lpRect As Long, ByVal bErase As Long) As Long
  4. Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
  5. Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
  6. Public Const GW_CHILD = 5
  7. Public Const WS_EX_LAYOUTRTL = &H400000
  8. Public Const GWL_EXSTYLE = (-20)
  9.  
At the form load add the mirroring effect as follows
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load() 'On Form Load you need to set 
  2.     Dim OldLong As Long
  3.     'For TreeView
  4.     Dim nodX As Node
  5.     Set nodX = TreeView1.Nodes.Add(, , "R", "Root")
  6.     Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C1", "Child 1")
  7.     Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C2", "Child 2")
  8.     Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C3", "Child 3")
  9.     Set nodX = TreeView1.Nodes.Add("R", tvwChild, "C4", "Child 4")
  10.     nodX.EnsureVisible
  11.     OldLong = GetWindowLong(TreeView1.hwnd, GWL_EXSTYLE)
  12.     SetWindowLong TreeView1.hwnd, GWL_EXSTYLE, OldLong Or WS_EX_LAYOUTRTL
  13.     InvalidateRect hwnd, 0, False
  14. End Sub
  15.  
http://www.microsoft.com/middleeast/msdn/faq.aspx
Feb 13 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: harry | last post by:
I want to be able to change the text alignment within a table cell between "right" & "center" depending on how many rows are in the table. Is this possible in Javascript? - can't see how to do...
4
by: Shashi | last post by:
Can somebody explain how the byte alignment for structures work, taking the following example and considering: byte of 1 Byte word of 2 Bytes dword of 4 Bytes typedef struct { byte a; word...
1
by: Srinivasa Raghavan | last post by:
Hi All, I have some doubts on the Treeview control and Form Authentication 1) will Form Authentication work if cookies are disabled. 2) I have problem in the following code (TreeView...
1
by: Joerg Trumpfheller | last post by:
Hey people, how can I select a treenode with the MouseButtons.Right event if there is no contextmenu? I build up a treeview with 3 levels. Only if the second level is selected, there should...
1
by: Alex D. | last post by:
hey guys I found what is causing the problems with my treeview in Firefox...the answer is: treeview+dropdwonlist in the same page dont work! try this simple code and see for yourselves. you can do...
2
by: Elton Pruitt | last post by:
The documentation on the ASP.NET 2.0 TreeView control, located at http://msdn2.microsoft.com/en-us/k5c13faz(VS.80).aspx says that "Node text ... can be displayed as either plain text or...
1
by: Alan T | last post by:
I selected a node in treeview, however, if I right click another node and after exited the pop up menu this "right clicked" node is not selected. How do I make this "right clicked" node is selected...
2
by: dexz | last post by:
Hi Using the following code I defined that when Im loading the Announcements into the program it marks the some of them with various icons in the TreeView. This was fairly easy, because when I...
0
by: yogarajan | last post by:
hi all i need proper alignment my treeview looks like <checkbox>Fruits(parent)-134 <checkbox>Mango(child)-45 <checkbox>Orange(child)-45 ...
0
by: Michael A. Covington | last post by:
Query: Is there a simple setting that makes the WPF TreeView be connected together by lines the way the WinForms TreeView is? If this is not the right newsgroup for WPF, where should I be asking?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.