Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:26:19+00:00 2026-06-13T11:26:19+00:00

I am experiencing the well known issue where after setting a TreeNode’s font to

  • 0

I am experiencing the well known issue where after setting a TreeNode’s font to bold, the text of the TreeNode gets truncated. However, I believe I have found a situation in which all of the commonly accepted “fixes” fail to work.

Common Solution: http://support.microsoft.com/kb/937215

node.NodeFont = new System.Drawing.Font(node.NodeFont, FontStyle.Bold);
node.Text += string.Empty;

Variation 1: C# Winforms bold treeview node doesn't show whole text (see BlunT’s answer)

node.NodeFont = new System.Drawing.Font(node.NodeFont, FontStyle.Bold);
node.Text = node.Text;

Variation 2: http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/acb877a6-7c9d-4408-aee4-0fb7db127934

node.NodeFont = new System.Drawing.Font(node.NodeFont, FontStyle.Bold);
treeView1.BackColor = treeView1.BackColor;      

Scenario In Which Above Fixes Do Not Work:

If the code that sets the node to bold is in the constructor (either of a form or, in this case, a user control), the fixes will not work:

public partial class IncidentPlanAssociations : UserControl
{
    public IncidentPlanAssociations()
    {
        InitializeComponent();

        TreeNode node = new TreeNode("This is a problem.");
        node.NodeFont = new Font(treeView1.Font, FontStyle.Bold);
        treeView1.Nodes.Add(node);

        // This does not fix problem
        node.Text += string.Empty;

        // This does not fix problem
        node.Text = node.Text;

        // This does not fix problem
        treeView1.BackColor = treeView1.BackColor;

    }
}

However, if I place any of these three “fixes” in code behind a button and click it after everything runs it will work just fine. I’m sure this is something to do with when the treeview is initially drawn or something, but I’m trying to figure out a good way around it. Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:26:20+00:00Added an answer on June 13, 2026 at 11:26 am

    Thanks @Robert Harvey for the assistance.

    In case anyone is experiencing a similar issue, the workaround here was to move the code from the Constructor to the User Control’s Load event. Any of the three variations above then work.

    I personally chose to go with:

    private void IncidentPlanAssociations_Load(object sender, EventArgs e)
    {
        TreeNode node = new TreeNode("This is no longer a problem.");
        node.NodeFont = new Font(treeView1.Font, FontStyle.Bold);
        treeView1.Nodes.Add(node);
    
        // This fixes the problem, now that the code 
        //      is in the Load event and not the constructor
        node.Text = node.Text;
    
    }
    

    The code just needed to be in the Load event and not in the constructor for this workaround to the well-known bug to work correctly for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am experiencing inconsistent behavior across machines with conversion to Well-Known Text (WKT) of
Some reasons i am experiencing this issue on my website. When the website loads
I'm experiencing some IE7 nightmares. The page in question works perfectly well in chrome,
how can i make this.... goto this link and see the text sliding after
We've been experiencing a very serious issue with IIS and Azure. Not sure if
Experiencing jquery in rails through .js.erb templates; but completely puzzled by a simple problem
When experiencing networking problems on client machines, I'd like to be able to run
Im experiencing a strange situation which i was supposed to handle. The situation is:
i am currently experiencing a problem were i get *** glibc detected *** ./efit:
The problem I'm experiencing is when I add the message Body part of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.