473,792 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

NodeFont change results in truncated text (bug in .NET Framework)

Seems that there's a bug in the TreeNode object. When you change the font,
it does not readjust its size appropriately.

The following code shows the boldface text truncated with everything after
"W" removed.

private void Form1_Load(obje ct sender, System.EventArg s e) {
TreeNode newNode = new TreeNode("ABCDE FGHIJKLMNOPQRST UVWXYZ");
treeView1.Nodes .Add(newNode);
newNode = new TreeNode("ABCDE FGHIJKLMNOPQRST UVWXYZ");
newNode.NodeFon t = new Font(this.Font, FontStyle.Bold) ;
treeView2.Nodes .Add(newNode);
}

What I want to know is, how do I work around this? I need some of the nodes
to be in bold!

Thanks,
Jon
Nov 15 '05 #1
2 4466
Hi Jon,

I agree this *looks* as a bug, but I believe this behavior is documented in
MSDN that warns the text *will* be truncated if the node font is larger than
the tree font. The trick I've used was to set the base tree font to bold,
and reset the boldness flag on all nodes that didn't need to be rendered in
bold face.

P.S. Dirty hack, I know :-)

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:ee******** ******@TK2MSFTN GP12.phx.gbl...
Seems that there's a bug in the TreeNode object. When you change the font,
it does not readjust its size appropriately.

The following code shows the boldface text truncated with everything after
"W" removed.

private void Form1_Load(obje ct sender, System.EventArg s e) {
TreeNode newNode = new TreeNode("ABCDE FGHIJKLMNOPQRST UVWXYZ");
treeView1.Nodes .Add(newNode);
newNode = new TreeNode("ABCDE FGHIJKLMNOPQRST UVWXYZ");
newNode.NodeFon t = new Font(this.Font, FontStyle.Bold) ;
treeView2.Nodes .Add(newNode);
}

What I want to know is, how do I work around this? I need some of the nodes to be in bold!

Thanks,
Jon


Nov 15 '05 #2
Thank you. That makes it a documented bug, but still a bug. But the
workaround should work. Thanks.

Jon
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote
in message news:uE******** ******@TK2MSFTN GP09.phx.gbl...
Hi Jon,

I agree this *looks* as a bug, but I believe this behavior is documented in MSDN that warns the text *will* be truncated if the node font is larger than the tree font. The trick I've used was to set the base tree font to bold,
and reset the boldness flag on all nodes that didn't need to be rendered in bold face.

P.S. Dirty hack, I know :-)

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jon Davis" <jo*@REMOVE.ME. PLEASE.jondavis .net> wrote in message
news:ee******** ******@TK2MSFTN GP12.phx.gbl...
Seems that there's a bug in the TreeNode object. When you change the font, it does not readjust its size appropriately.

The following code shows the boldface text truncated with everything after "W" removed.

private void Form1_Load(obje ct sender, System.EventArg s e) {
TreeNode newNode = new TreeNode("ABCDE FGHIJKLMNOPQRST UVWXYZ");
treeView1.Nodes .Add(newNode);
newNode = new TreeNode("ABCDE FGHIJKLMNOPQRST UVWXYZ");
newNode.NodeFon t = new Font(this.Font, FontStyle.Bold) ;
treeView2.Nodes .Add(newNode);
}

What I want to know is, how do I work around this? I need some of the

nodes
to be in bold!

Thanks,
Jon

Nov 15 '05 #3

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

Similar topics

6
1657
by: Thomas Scheiderich | last post by:
I have the following page as test.aspx: *************************************************** <html> <head> <title>Hello and Welcome Page</title> </head> <body> <center> <% Dim CurrentDate As String
4
3571
by: kristofera | last post by:
I am trying to do a distinct grouping of some nodes sorted by a numeric value but for some reason the distinct (preceding-sibling filter) is applied to the result as if not sorted. If I don't use the preceding-sibling filter, the nodes are properly sorted. Is this a bug in the xslt processor I'm using (.net framework 1.1) or is this correct behaviour? Any alternative solutions that will show me the lowest priced item in each category?...
6
3184
by: Cro | last post by:
Dear Access Developers, The 'Allow Additions' property of my form is causing unexpected results. I am developing a form that has its 'Default View' property set to 'Continuous Forms' and am displaying records that match an SQL statement entered in the 'Record Source' property of the form. The form behaves correctly and displays the records as expected. The
2
3737
by: | last post by:
Hi everyone, I'm using VS.NET, Framework 1.1, Windows 2000 Server, IIS 5, all the latest patches are installed. Im having this wierd random problem, that I cannot reproduce but it happens quite often: - my Request.Form collection is truncated in some posts (again I dont know why or how to reproduce it).
1
8781
by: Kuldeep | last post by:
When i export data from MySQL(server 5.0) i get followng error. SQLSTATE: 01004 String data, right truncated can sombody explain why this is happenning and possible solution!!! consider it as a bit urgent!!!
7
4654
by: TC | last post by:
I've produced an Access application for a client. For one report, text gets cut-off at the right margin when we print the report. It does this only when we print; it doesn't happen when we view the report in preview mode. Also, it occurs only at the client site; it doesn't occur at my office or on any other computer I've tried. I can describe the problem best with a specific example. (This is a contrived example, but it is faithful to...
11
1987
by: Ken Fine | last post by:
I am using VS.NET 2008 and like it a lot. One of the very few things I don't like is a bug that seems to spawn literally thousands of   strings, one after the other, on design view changes. Sometimes I will end up with as many as 30,000 of them. I have to do a "Replace" which is slower than I'd like. This is slowing down my work a lot. This might be related to a commercial control I'm using, or it may just be VS.NET's indentation getting...
2
2755
by: Dennis | last post by:
I am using VS 2005. I have a form with a TreeView. I want to change the font of the root node to bold. But when I do, running the program causes the text in that node to appear truncated ... as if the node doesn't have the room for the bolded text to entirely fit. Is there something I need to do to the node to adjust its width? -- Dennis
12
2059
by: Juan T. Llibre | last post by:
re: !I found an MSDN document that explains why what I'm trying to do should work Lee, From : http://www.w3.org/TR/REC-xml/ "A special attribute named xml:lang may be inserted in documents to specify the
0
10211
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10159
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9033
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4111
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
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.