C# UltraTree基础设施如何改变UltraTreeNode的背景色?

C# UltraTree基础设施如何改变UltraTreeNode的背景色?,c#,winforms,infragistics,C#,Winforms,Infragistics,我在UltraTree中有一个文本搜索编辑器。当此编辑器中的文本与UltraTreeNode.text匹配时,匹配节点的颜色将为黄色。我怎么做 private void _SearchRole() { string strMatch = this.ultraTextEditorRoleSearch.Text.Trim().ToLower(); if(strMatch == string.Empty) { //全部恢复原来的颜色 foreac

我在UltraTree中有一个文本搜索编辑器。当此编辑器中的文本与UltraTreeNode.text匹配时,匹配节点的颜色将为黄色。我怎么做

private void _SearchRole()
{
    string strMatch = this.ultraTextEditorRoleSearch.Text.Trim().ToLower();
    if(strMatch == string.Empty)
    {
        //全部恢复原来的颜色
        foreach(var node in this.treeRole.Nodes)
        {
            if (node.Selected) node.Control.Appearance.BackColor = SystemColors.Highlight;
            else node.Control.Appearance.BackColor = SystemColors.GradientActiveCaption;
        }
    }
    else
    {
        foreach(var node in this.treeRole.Nodes)
        {
            if (node.Selected) node.Control.Appearance.BackColor = SystemColors.Highlight;
            else if(node.Text.Contains(strMatch))
            {
                node.Control.Appearance.BackColor = Color.Yellow;
            }
            else
            {
                node.Control.Appearance.BackColor = SystemColors.GradientActiveCaption;
            }
        }
    }            
}

我像上面那样尝试过,但没有任何结果…

要更改节点的背景色,必须使用
覆盖

node.Override.NodeAppearance.BackColor = Color.Yellow;

非常感谢你!!!这是我在stackoverflow中问的第一个问题。我很惊讶我的问题这么快就被回答和解决了。真的很感激!