My app sets a treenodes font property to bold but the width of the item doesn't expand to cope with the obvious increase in size of the text.
What it leads to is items made bold at runtime becoming truncated in appearance.
Is there a quick fix?
Printable View
My app sets a treenodes font property to bold but the width of the item doesn't expand to cope with the obvious increase in size of the text.
What it leads to is items made bold at runtime becoming truncated in appearance.
Is there a quick fix?
Had exactly the same problem and I opted for changing the HideSelection to false which solves the problem of showing which node was selected.
If there is a quick fix I like to know as well.
I finally went for a crude method of building each node with 4 spaces appended to the end of each nodes text, when it was made bold the spaces are all that is truncated.
Didn't read you post until after I'd coded it.
One drawback is that any reference to the node.text value has to be wrapped in a trim function.
I decided to build a new class that could be stored in node.tag that contained all the info I needed for click events and therefore node.text is purely for display.
It's an ugly solution I know but at least it works and didn't waste too much time.
Cheers for the help
have you tried adding space at the end of the item? also how are you setting the Font?
i did this quick example and it worked fine ...
VB Code:
Dim tn As New TreeNode("some text in bold... ") tn.NodeFont() = New Font(TreeView1.Font.Name, TreeView1.Font.Size, FontStyle.Bold, TreeView1.Font.Unit, TreeView1.Font.GdiCharSet) TreeView1.Nodes.Add(tn)
Know this is an old post, but for incase someone try to make an existing node bold....
If your labeledit property is set to False, then part of you node text will not show after you set it's font to bold.
So just before you set the node font to bold, first set the labeledit property to True, and reset it afterwards
Code:tvwCube.LabelEdit = True
DimensionNode.NodeFont() = New System.Drawing.Font(tvwCube.Font.Name, tvwCube.Font.Size, System.Drawing.FontStyle.Bold, tvwCube.Font.Unit, tvwCube.Font.GdiCharSet)
tvwCube.LabelEdit = False
Thanks much appreciated