Home All Groups Group Topic Archive Search About

How to resize a TreeNode after changing its font?

Author
3 Apr 2005 12:02 PM
Fabio Cannizzo
I execute the following code:

myTreeNode.NodeFont = new Font( ... );

However this does not change the Bounds of the TreeNode and as a result the
TreeNode's Text does no longer fit and it in the Bounds rectangle and it is
not displayed properly (it is trimmed).

Does anybody know how to change the TreeNode.Bounds at runtime?

Note that I do not want to change the Font property for the all TreeView,
but only for that specific TreeNode.

Thanks
Fabio

Author
3 Apr 2005 12:09 PM
Stephany Young
Do the reverse. Set the font of the TreeView to the bigger font at design
time and at runtime, change the Nodefont of all the other TreeNodes to the
small one.

I knock it's a 'hack' but it works.


Show quoteHide quote
"Fabio Cannizzo" <fcannizzo.mifft2***@london.edu> wrote in message
news:NXQ3e.4325$Br.1180@newsfe2-win.ntli.net...
>I execute the following code:
>
> myTreeNode.NodeFont = new Font( ... );
>
> However this does not change the Bounds of the TreeNode and as a result
> the TreeNode's Text does no longer fit and it in the Bounds rectangle and
> it is not displayed properly (it is trimmed).
>
> Does anybody know how to change the TreeNode.Bounds at runtime?
>
> Note that I do not want to change the Font property for the all TreeView,
> but only for that specific TreeNode.
>
> Thanks
> Fabio
>
>
Are all your drivers up to date? click for free checkup

Author
3 Apr 2005 12:16 PM
Fabio Cannizzo
Hi Stephanie.

Thanks for your suggestion. Actually I thought about that and if I cannot
find another way I'll go it.
I was hoping there was other solution. May be using the API?

Fabio

Show quoteHide quote
"Stephany Young" <noone@localhost> wrote in message
news:%23C1e4XEOFHA.2132@TK2MSFTNGP14.phx.gbl...
> Do the reverse. Set the font of the TreeView to the bigger font at design
> time and at runtime, change the Nodefont of all the other TreeNodes to the
> small one.
>
> I knock it's a 'hack' but it works.
>
>
> "Fabio Cannizzo" <fcannizzo.mifft2***@london.edu> wrote in message
> news:NXQ3e.4325$Br.1180@newsfe2-win.ntli.net...
>>I execute the following code:
>>
>> myTreeNode.NodeFont = new Font( ... );
>>
>> However this does not change the Bounds of the TreeNode and as a result
>> the TreeNode's Text does no longer fit and it in the Bounds rectangle and
>> it is not displayed properly (it is trimmed).
>>
>> Does anybody know how to change the TreeNode.Bounds at runtime?
>>
>> Note that I do not want to change the Font property for the all TreeView,
>> but only for that specific TreeNode.
>>
>> Thanks
>> Fabio
>>
>>
>
>

Bookmark and Share