Changing the TreeNode NodeFont to a bold font chops of text

  • Thread starter Thread starter Jeroen-bart Engelen
  • Start date Start date
J

Jeroen-bart Engelen

Hello,

I have a TreeView filled with nodes and then later on I wish to change
some node labels to a bold font. When I do this, the lenght of the
label gets longer, the boldness takes up more space, but instead of
showing al the text, the text gets cut off at a certain point. It seems
like the new bold text cannot be longer then the longest regular text.

Does anyone have an idea how to fix this?

Thanks,
Jeroen-bart Engelen
 
From the docs for TreeNode.NodeFont:
"If the node font is larger than the Font property value set in the TreeView
control, the tree node label text is clipped."

Solution is to reverse your thinking. Set the entire tree to use a bold font
and then change the nodes you don't want bold.

/claes
 
Claes said:
From the docs for TreeNode.NodeFont:
"If the node font is larger than the Font property value set in the TreeView
control, the tree node label text is clipped."

Solution is to reverse your thinking. Set the entire tree to use a bold font
and then change the nodes you don't want bold.

Thanks. I set it to bold and it fitted perfectly. Too perfect actually,
so I added an additional space at the end of the string when I set it
to bold. And now it even looks great! :-)

Jeroen-bart Engelen
 
Back
Top