packages/Windows API Code Pack 1.1/source/Samples/DirectX/CS/Direct2D/D2DShapes/D2DShapesControlWithButtons.cs
/// <summary>
/// Remove shape from the tree node collection
/// </summary>
/// <param name="shape"></param>
/// <param name="treeNodes"></param>
/// <returns>true if removed</returns>
Remove shape from the tree node collection
Remove shape from the tree node collection
private static bool RemoveFromTree(DrawingShape shape, TreeNodeCollection treeNodes)
        {
            foreach (TreeNode node in treeNodes)
            {
                if (node.Tag == shape)
                {
                    treeNodes.Remove(node);
                    return true;
                }
                if (node.Nodes.Count > 0 && RemoveFromTree(shape, node.Nodes))
                    return true;
            }
            return false;
        }
private static bool RemoveFromTree ( DrawingShape shape , TreeNodeCollection treeNodes ) { foreach ( TreeNode node in treeNodes ) { if ( node . Tag == shape ) { treeNodes . Remove ( node ) ; return true ; } if ( node . Nodes . Count > 0 && RemoveFromTree ( shape , node . Nodes ) ) return true ; } return false ; }
Remove shape from the tree node collection
Remove shape from the tree node collection
true if removed
true if removed
shape
DrawingShape
None
treeNodes
TreeNodeCollection
None