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

Re: TreeView node chopping off bold text in framework 1.1 by Herfried

Herfried
Wed Sep 20 16:56:49 CDT 2006

"Roy" <Roy@discussions.microsoft.com> schrieb:
>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 S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


Re: TreeView node chopping off bold text in framework 1.1 by Mattias

Mattias
Wed Sep 20 17:02:29 CDT 2006

>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

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

Re: TreeView node chopping off bold text in framework 1.1 by Roy

Roy
Thu Sep 21 05:00:01 CDT 2006



"Herfried K. Wagner [MVP]" wrote:

> "Roy" <Roy@discussions.microsoft.com> schrieb:
> >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 S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
>

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: TreeView node chopping off bold text in framework 1.1 by Roy

Roy
Thu Sep 21 05:09:01 CDT 2006


> 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
>
> --
> Mattias Sjögren [C# MVP] mattias @ mvps.org
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.

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

Re: TreeView node chopping off bold text in framework 1.1 by FUnky

FUnky
Thu Sep 21 05:44:24 CDT 2006

First make that single node bold. then set its text.

FUnky



Re: TreeView node chopping off bold text in framework 1.1 by Herfried

Herfried
Thu Sep 21 07:17:01 CDT 2006

"Roy" <Roy@discussions.microsoft.com> schrieb:
>> >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 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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>