TreeView node chopping off bold text in framework 1.1

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)));
..
..
 
H

Herfried K. Wagner [MVP]

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.
 
M

Mattias Sjögren

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
 
G

Guest

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?
 
G

Guest

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
 
H

Herfried K. Wagner [MVP]

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.
 

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