TreeNode Label

J

Juan Romero

Hey guys,

I have been playing with different fonts for the nodes of a treeview.
When I change the font to bigger sizes, the text area of the treenode
(label) no
longer displays all the text. I only see what fits there. How do I resize
this area? I mean, one would expect the label box to resize itself.....

Any ideas?

Thanks in advance!
 
H

Herfried K. Wagner [MVP]

* "Juan Romero said:
I have been playing with different fonts for the nodes of a treeview.
When I change the font to bigger sizes, the text area of the treenode
(label) no
longer displays all the text. I only see what fits there. How do I resize
this area? I mean, one would expect the label box to resize itself.....

I am not able to repro that, even with very long texts.
 
C

Cor

Hi Herfried,

This has been more here, it is not the long text but the font seems to get
to high and the top is cut off, do you know it?

Cor
 
J

Juan Romero

Here is the code to reproduce it:

Dim oNode As New TreeNode
oNode.ImageIndex = 3
oNode.SelectedImageIndex = 3
oNode.NodeFont = New Font("Tahoma", 8, FontStyle.Bold)
oNode.Text = "Control Panel"
tvMenus.Nodes.Add(oNode)
tvMenus.Refresh()

Thank you for your help. I appreciate it.
 
H

Herfried K. Wagner [MVP]

* "Juan Romero said:
Here is the code to reproduce it:

Dim oNode As New TreeNode
oNode.ImageIndex = 3
oNode.SelectedImageIndex = 3
oNode.NodeFont = New Font("Tahoma", 8, FontStyle.Bold)
oNode.Text = "Control Panel"
tvMenus.Nodes.Add(oNode)
tvMenus.Refresh()

Set the TreeView's 'Font' property to the bold font too.
 
H

Herfried K. Wagner [MVP]

* "Cor said:
This has been more here, it is not the long text but the font seems to get
to high and the top is cut off, do you know it?

Setting the control's 'Font' property to a large font will fix this
problem, I think.
 
J

Juan Romero

Yes, it did fix it.
Of course this is more of a workaround than a solution. It seems like you
have to set the font to the largest and thickest font you will use on your
treeview, and then create all the nodes, making a new font for them, except
for the one that has the font in question.

Thanks a lot guys.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top