TreeView node chopping off bold text in framework 1.1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a TreeView control and I populate nodes and set their text property.
If I make the font of the tree node bold, the part of the last letter is
chopped off when displayed. It seems like the length of the tree node label
is tied to the normal look of the font, and since the bold view makes the
text take mode place, the text is chopped off.

Any ideas?
..
..
TreeNode nodePrfTitle = new TreeNode("Preferred Name");
nodePrfTitle.ImageIndex = 2;
nodePrfTitle.SelectedImageIndex = 2;
nodePrfTitle.NodeFont = new System.Drawing.Font("Microsoft Sans Serif",
8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
..
..
 
Roy said:
I have a TreeView control and I populate nodes and set their text property.
If I make the font of the tree node bold, the part of the last letter is
chopped off when displayed. It seems like the length of the tree node
label
is tied to the normal look of the font, and since the bold view makes the
text take mode place, the text is chopped off.

Set the treeview control's font to the bold font and unbold the font of the
normal items.
 
I have a TreeView control and I populate nodes and set their text property.
If I make the font of the tree node bold, the part of the last letter is
chopped off when displayed. It seems like the length of the tree node label
is tied to the normal look of the font, and since the bold view makes the
text take mode place, the text is chopped off.

Any ideas?

This is an old "feature" of the native Treeview control. It's
mentioned in the Remarks section of

http://windowssdk.msdn.microsoft.com/en-us/library/ms650133.aspx

One workaround is to bold the item by sending the TVM_SETITEM message
(with TVIF_STATE and TVIS_BOLD) to the control instead.


Mattias
 
Herfried K. Wagner said:
Set the treeview control's font to the bold font and unbold the font of the
normal items.

I want my tree to have normal font nodes, and only a few selected to be
bold, so how do I get the bold nodes to chop the text?
 
This is an old "feature" of the native Treeview control. It's
mentioned in the Remarks section of

http://windowssdk.msdn.microsoft.com/en-us/library/ms650133.aspx

One workaround is to bold the item by sending the TVM_SETITEM message
(with TVIF_STATE and TVIS_BOLD) to the control instead.


Mattias

Will that work for a singel node as well (I want the rest of the tree to be
in normal font mode - so the default font is fine for the rest of the tree).
And if yes, can you give me an example on how I do it for a single node?

Thank you very much for the reply.

Roy
 
Roy said:
I want my tree to have normal font nodes, and only a few selected to be
bold, so how do I get the bold nodes to chop the text?

Re-read what I have written.
 
Back
Top