4

When inserting a node in TreeView with long text - horizontal scrollbar appears. Is there a way to word wrap the text in TreeNode, instead of scrolling?

Currently I use solution that splits the text according to TreeView's width and display its chunks in different nodes, but the "alignment" doesn't holds after resizing and just looks weird.

yzorg
  • 4,224
  • 3
  • 39
  • 57
nichiporets
  • 431
  • 7
  • 18

2 Answers2

4

Setting the Scrollable property of your TreeView to false will eliminate the scrollbars, but it will also cut off your text -- probably not what you want.

This MSDN Forum thread give an answer that seems workable, but I don't know that you're interested in using the OwnerDrawText function to draw the nodes yourself.

Personally, I'd try to rethink the whole thing, if possible -- shorter node text, bigger tree area, etc.

Community
  • 1
  • 1
Michael Sallmen
  • 728
  • 5
  • 13
0

I found this when I had a similar issues, it might be helpful: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.treeview.nodewrap%28v=vs.110%29.aspx . Note its only for the web (ASP.NET).

Dan Gifford
  • 886
  • 1
  • 9
  • 33