我在 UltraTree 中有一个 textSearchEditor。当此编辑器中的文本与 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;
}
}
}
}
我像上面一样尝试过,但没有任何反应......