/// <summary> /// Adds a <see cref="TreeNodeExItem" /> object to the specified tree node collection. /// </summary> /// <param name="collection">The tree node collection to which the item should be added.</param> /// <param name="item">The <see cref="TreeNodeExItem" /> object to be added.</param> /// <returns>A <see cref="TreeNode" /> which contains the <see cref="TreeNodeExItem" /> data.</returns> public TreeNode AddItem(TreeNodeCollection collection, TreeNodeExItem item) { var imageIndex = this.ImageList == null ? -1 : this.ImageList.Images.Count + 1; var treeNode = collection.Add(item.Title); treeNode.Tag = item; treeNode.ImageIndex = treeNode.SelectedImageIndex = treeNode.StateImageIndex = imageIndex; return(treeNode); }
/// <summary> /// Adds a <see cref="TreeNodeExItem" /> object to the specified tree node collection. /// </summary> /// <param name="collection">The tree node collection to which the item should be added.</param> /// <param name="item">The <see cref="TreeNodeExItem" /> object to be added.</param> /// <returns>A <see cref="TreeNode" /> which contains the <see cref="TreeNodeExItem" /> data.</returns> public TreeNode AddItem(TreeNodeCollection collection, TreeNodeExItem item) { var imageIndex = this.ImageList == null ? -1 : this.ImageList.Images.Count + 1; var treeNode = collection.Add(item.Title); treeNode.Tag = item; treeNode.ImageIndex = treeNode.SelectedImageIndex = treeNode.StateImageIndex = imageIndex; return treeNode; }