473,587 Members | 2,230 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TreeView node in bold has incorrect length

Hi,

When I set the text of a TreeView node to bold (or Italic for that matter)
programmaticall y, 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 7642

"Marcel Brekelmans" <ma****@marce l-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)
programmaticall y, 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.ed u.for.addresssc hreef in bericht
news:OX******** ******@TK2MSFTN GP06.phx.gbl...
>
"Marcel Brekelmans" <ma****@marce l-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) programmaticall y, 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) programmaticall y, 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
programmaticall y 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
7586
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
15070
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
4743
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 behavior, if I delete all childnodes, when the parent node is expanted, and rebuild all child treenodes, I can make an childnode bold without clipping it....
3
2244
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 child node or a leaf node then a DataGrid is populated based on the node's ID property. If I expand a node then the DataGrid is not populated. This...
4
2986
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 right, the item on the TreeView is no longer highlighted, making it hard to keep track of which item you clicked on the TreeView. I want the...
18
15354
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 click to make multiple selections. Then when I simply click one item, all previous selections are gone. Thanks in advance.
2
5487
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 programmatically. And I want to bind the selection of a TreeNode (which is a record) from the database) to a DetailsView which shows the datatable record for the...
0
1890
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 current selection and stuff in the tree. I post my code here, any idea ?
5
7510
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 button (+) resides right at the middle of multi-line text. Can I make the expand button top align instead of middle align?
0
8205
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.