473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

TreeView node in bold has incorrect length

Hi,

When I set the text of a TreeView node to bold (or Italic for that matter)
programmatically, it doesn't show up with its length adjusted. Instead, it
has the length of the text in normal font, so it is clipped at the end. Does
anyone know of a workaround?

Thanks
Jan 13 '07 #1
3 7630

"Marcel Brekelmans" <ma****@marcel-art.comwrote in message
news:-9******************************@giganews.com...
Hi,

When I set the text of a TreeView node to bold (or Italic for that matter)
programmatically, it doesn't show up with its length adjusted. Instead, it
has the length of the text in normal font, so it is clipped at the end.
Does anyone know of a workaround?

Thanks

Not exactly, but try changing the font of the TreeView from "MS Sans Serif"
to Tahoma. In fact, do that to your whole form and make sure the TreeView
inherits it. "MS Sans Serif" is the default font of older .NET versions and
is a flawed font -- I have had other problems with its spacing and width.

See this:
http://www.covingtoninnovations.com/...ex.html#060312

Jan 13 '07 #2
Hi Michael,

I tried your solution. Unfortunately, it doesn't help: the textlength is
still based on the 'Normal' font.

However, I came across another approach which does a good job: make the font
of the TreeView Bold in the constructor. For each TreeNode you add, make its
font Normal. That way, the length of the TreeNode.Text is based on the Bold
font and when you make it actually bold it is not clipped.

Thanks anyway.
"Michael A. Covington" <lo**@ai.uga.edu.for.addressschreef in bericht
news:OX**************@TK2MSFTNGP06.phx.gbl...
>
"Marcel Brekelmans" <ma****@marcel-art.comwrote in message
news:-9******************************@giganews.com...
>Hi,

When I set the text of a TreeView node to bold (or Italic for that
matter) programmatically, it doesn't show up with its length adjusted.
Instead, it has the length of the text in normal font, so it is clipped
at the end. Does anyone know of a workaround?

Thanks


Not exactly, but try changing the font of the TreeView from "MS Sans
Serif" to Tahoma. In fact, do that to your whole form and make sure the
TreeView inherits it. "MS Sans Serif" is the default font of older .NET
versions and is a flawed font -- I have had other problems with its
spacing and width.

See this:
http://www.covingtoninnovations.com/...ex.html#060312

Jan 13 '07 #3
Marcel Brekelmans wrote:
Hi,

When I set the text of a TreeView node to bold (or Italic for that
matter) programmatically, it doesn't show up with its length
adjusted. Instead, it has the length of the text in normal font, so
it is clipped at the end. Does anyone know of a workaround?
This is an issue in windows. I ran into this as well some time ago and
decided to go with an alternative color instead. The workaround, which
you probably won't like, is to set all texts to bold initially and then
programmatically set every node's text which has to be normal looking
to normal font.

If I'm not mistaken, Raymond Chen (The 'OldNewThing' blog) blogged
about the reason for this some time ago, but I can't find the exact
link. What I do know is that it's an issue in windows.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Jan 14 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ian Powell | last post by:
Hi I've got objects in an sorted ArrayList like: P:\ P:\\DOCS P:\\i386 P:\\i386\ASMS P:\\i386\ASMS\1000 P:\\i386\ASMS\1000\MSFT
14
by: Mr.D | last post by:
How do I save/load the contents of a Treeview to a file? I have found several good examples written i VB6, but not a single one for VB.NET. Please help. ---- Tim
11
by: Mano | last post by:
When settiing a TreeNode to bold the text label of that node is clipped. As describedin in the Bug Rebort FDBK16963 I set the underliying TreeView Fond to be bold. Now I have the strange...
3
by: Shawn | last post by:
Hi. I'm working with the TreeView control in my ASP.NET 1.1 application. I have a problem I haven't been able to figure out. When I click on a node (not expand), whether it's a parent node, a...
4
by: Xenomorph | last post by:
I have a program where you click an item on the TreeView on the left, and then work with whatever pops up on the right. There are many entries on the TreeView, and when you click something on the...
18
by: =?Utf-8?B?TGkgV2VuZw==?= | last post by:
Hi, Is there a way for TreeView to have multiple selections? But I am not talking about its checked boxes. I want a way similar to ListView with MultiSelect = True. So I can use or key and...
2
by: makennedy | last post by:
Hi Experts, Please help, I am a newbie to ASP.NET 2.0 may be I am doing something wrong or there may be a bug somewhere. Basically I have a TreeView Control which I have created...
0
by: Falcula | last post by:
Hello, I have a treeview that i fill from a database, when i update nodename in database the treeview dont update. Its works when iam not useing enableviewstate="true" but then i loosing the...
5
by: Max2006 | last post by:
Hi, I have a TreeView and this is my node style: <asp:TreeNodeStyle ForeColor = "#000000" Font-Size="9px" Font-Bold="false" Width="100px" NodeSpacing="3px" /> The problem is the expand...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.