private void RecursiveCaptureLeaf(Brother brother, MouseEventArgs mouseEvent) { if( brother.Label.Parent == null ) return; brother.lastPoint = mouseEvent.Location; brother.Label.BringToFront(); if( brother.HasRightSibling() ) { RecursiveCaptureLeaf( (Brother) brother.GetRightSibling(), mouseEvent ); } if( brother.HasChild() ) { RecursiveCaptureLeaf( (Brother) brother.GetFirstChild(), mouseEvent ); } }
private static void RecursiveMoveLeaf(Brother brother, int distanceInXDirection, int distanceInYDirection) { if( brother.Label.Parent != null ) { brother.Label.Location = new Point( brother.Label.Left + distanceInXDirection, brother.Label.Top + distanceInYDirection ); } if( brother.HasRightSibling() ) { RecursiveMoveLeaf( (Brother) brother.GetRightSibling(), distanceInXDirection, distanceInYDirection ); } if( brother.HasChild() ) { RecursiveMoveLeaf( (Brother) brother.GetFirstChild(), distanceInXDirection, distanceInYDirection ); } }