Não é mais possível fazer postagens ou usar assinaturas novas da Usenet nos Grupos do Google. O conteúdo histórico continua disponível.
Dismiss

TreeView Text Width Calculation Bug

20 visualizações
Pular para a primeira mensagem não lida

Bill Henning

não lida,
25 de jan. de 2002, 15:21:4225/01/2002
para
If I have a TreeView and fill it with nodes and then decide to change one of
the node's font styles to bold, the end of the text in that node gets
chopped off. It seems like the TreeView isn't taking the NodeFont's style
into account when calculating the width of the text. Here's the code to
make it happen on a node named treeNode in a TreeView named treeView:

treeNode.NodeFont = new Font(treeView.Font, FontStyle.Bold);

In this example, making the font bolder widens the text but the TreeView
doesn't adjust for this. I am using RTM by the way.

--
Bill Henning
Actipro Software LLC

Check out our .NET components at:
http://www.actiprosoftware.com/products/dotnet/


Jacob Grass (MVP)

não lida,
25 de jan. de 2002, 15:51:2225/01/2002
para
This is an old issue with the TreeView. The Platform SDK says the
following:

"For Version 5.0 of the common controls, these two controls may display
clipped text if you change the font by returning CDRF_NEWFONT. This behavior
is necessary for backward compatibility with earlier versions of the common
controls. If you want to change the font of a list-view or tree-view
control, you will get better results if you send a CCM_SETVERSION message
with the wParam value set to 5 before adding any items to the control."

And, the docs say the following:

"If the node font is larger than the Font property value set in the TreeView
control, the tree node label text is clipped."

A way around this is to set the Font of the treeview to be bolded and then
unbold the nodes you don't want bolded. . .

--
Jacob Grass
Microsoft .NET MVP

"Bill Henning" <ju...@actiprosoftware.com> wrote in message
news:uw3ut3dpBHA.1532@tkmsftngp03...

Nathan Alden

não lida,
26 de jan. de 2002, 13:32:2926/01/2002
para
You'd think Microsoft would fix these stupid little bugs by now. Sometimes
the littlest bugs are the most annoying.

Nate

"Jacob Grass (MVP)" <JGr...@AbilitiSolutions.com> wrote in message
news:#ciSOIepBHA.1744@tkmsftngp03...

0 nova mensagem