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 930459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:20:16+00:00 2026-05-15T20:20:16+00:00

I set the BackColor of specific TreeNodes in a TreeView as a hint to

  • 0

I set the BackColor of specific TreeNodes in a TreeView as a hint to the user that something interesting has happened to the node while they are using the application. However, when I set BackColor, it causes the entire parent TreeView control to redraw rather than just the label area of the specific TreeNode that has been changed. I am not calling Refresh or Update at any point — just setting BackColor on the TreeNode. It seems that rather than just invalidating the bounds of the TreeNode that has been changed, the TreeView is refreshing its entire area. This results in an annoying quick flash of the control.

Any idea why this happening and if it can be easily stopped?

  • 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-05-15T20:20:17+00:00Added an answer on May 15, 2026 at 8:20 pm

    It doesn’t look like you can stop this from occuring. I took a look at the code for the TreeNode.BackColor setter:

    [SRDescription("TreeNodeBackColorDescr"), SRCategory("CatAppearance")]
    public Color BackColor
    {
        get
        {
            if (this.propBag == null)
            {
                return Color.Empty;
            }
            return this.propBag.BackColor;
        }
        set
        {
            Color backColor = this.BackColor;
            if (value.IsEmpty)
            {
                if (this.propBag != null)
                {
                    this.propBag.BackColor = Color.Empty;
                    this.RemovePropBagIfEmpty();
                }
                if (!backColor.IsEmpty)
                {
                    this.InvalidateHostTree();
                }
            }
            else
            {
                if (this.propBag == null)
                {
                    this.propBag = new OwnerDrawPropertyBag();
                }
                this.propBag.BackColor = value;
                if (!value.Equals(backColor))
                {
                    this.InvalidateHostTree();
                }
            }
        }
    }
    

    Whenever the BackColor changes, an invalidate is forced on the tree that contains the node. Again, looking at the InvalidateHostTree function, there are no flags you can set to stop the refresh from occurring.

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

Sidebar

Related Questions

I have a custom control that has other controls on it. When the user
Set rs = conn.Execute(Statement) //rs has 6 fields I want to add the current
How can I set the backcolor of a control (equivilant of control.backcolor in .Net).
It's pretty straightforward to add simple properties to a User Control that will appear
How can I set a form's backcolor to a custom color (such as light
I'm trying to set the backColor of a text box like this: txtCompanyName.BackColor =
I'm using listview control with the following parameters set: this.listView1.BackColor = System.Drawing.Color.Gainsboro; this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[]
I know how to set a control's BackColor dynamically in C# to a named
the form backcolor is 14221235 , but when i set the customcolor in colordialog
I tried to set backcolor to transparent by solution given at msdn but failed

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.