/// <summary> /// Sets the background color of a node to blue. Then sets the background /// color of all parents recursively to blue, if they have not been set /// yet to yellow or red. /// </summary> /// <param name="node">The node to start with.</param> private static void SetNodeSkipped(SmartTreeNode node) { while (node.ImageIndex < 10) { node.ImageIndex += 5; } node.SelectedImageIndex = node.ImageIndex; if (node.Parent != null) { SmartTreeNode parent = node.Parent; SetNodeSkipped(parent); } node.Expand(); }
/// <summary> /// Sets the background color of a node to 'newColor'. Then sets the /// background color of all parents recursively to the same 'newColor' as /// well. /// </summary> /// <param name="node">The node to start with.</param> /// <param name="newColor">The new background color.</param> private static void SetNodeFailed(ref SmartTreeNode node, Color newColor) { while (node.ImageIndex < 15) { node.ImageIndex += 5; } node.SelectedImageIndex = node.ImageIndex; if (node.Parent != null) { SmartTreeNode parent = node.Parent; SetNodeFailed(ref parent, newColor); } node.Expand(); }