/* * [Function] * un highlight tree node * [Input] * some TreeNode * * [Output] * restore color to background color * * [Note] */ public Color unHighlightNode(TreeView trvValue, TreeNode treeNode) { Color oldColor = trvValue.BackColor; if (treeNode != null) { oldColor = treeNode.BackColor; treeNode.BackColor = trvValue.BackColor; treeNode.ForeColor = Color.Black; } return oldColor; }
例 1.2. unHighlightNode的使用范例
else if (e.ClickedItem == tsmiRemoveFromSelection) { if (curSelTreeNodeList.Contains(curSelTreeNode)) { //remove selection curSelTreeNodeList.Remove(curSelTreeNode); //unhightlight node crl.unHighlightNode(trvCategoryTree, curSelTreeNode); } }