/// <summary> /// Determines whether the specified item is located within the collection. /// </summary> /// <param name="value">An object representing the item to locate in the collection.</param> /// <returns>true if the item is located within the collection; otherwise, false .</returns> public bool Contains(ListItem value) { // Use base class to process actual collection operation //return base.List.Contains(value as object); return List.Contains(value); //return parent.arrList.Contains(value as object); }
// public new int Count // { // get // { // return parent.arrList.Count; // } // // } /// <summary> /// Returns the index within the collection of the specified item /// </summary> /// <param name="value">An object representing the item to locate in the collection.</param> /// <returns>The zero-based index where the item is located within the collection; otherwise, negative one (-1). </returns> public int IndexOf(ListItem value) { // Find the 0 based index of the requested entry return List.IndexOf(value); }
/// <summary> /// Inserts an item into the list box at the specified index. /// </summary> /// <param name="index">The zero-based index location where the item is inserted.</param> /// <param name="value">An object representing the item to insert.</param> public void Insert(int index, ListItem value) { // Use base class to process actual collection operation List.Insert(index, value as object); parent.RefreshItems(); }
// public void AddRange(ListItem[] values) // { // // Use existing method to add each array entry // foreach(ListItem page in values) // Add(page); // // parent.RefreshItems(); // } /// <summary> /// Removes the specified object from the collection. /// </summary> /// <param name="value">ListItem to remove</param> public void Remove(ListItem value) { List.Remove(value); parent.RefreshItems(); }
/// <summary> /// Adds an item to the list of items for a ListBoxEx . /// </summary> /// <param name="value">string for text property</param> /// <returns>Newly created ListItem</returns> public ListItem Add(string value) { // Use base class to process actual collection operation ListItem item = new ListItem(value); item.Parent = parent; item.Font = parent.Font; item.ForeColor = parent.ForeColor; if (!List.Contains(item)) List.Add(item); //MessageBox.Show("Items.Add"); //parent.arrList.Add(value); parent.RefreshItems(); return item; }
/// <summary> /// Adds an item to the list of items for a ListBoxEx . /// </summary> /// <param name="value">ListItem to add</param> /// <returns>Newly created ListItem</returns> public ListItem Add(ListItem value) { // Use base class to process actual collection operation // if (value.Font == null) value.Font = parent.Font; // if (value.ForeColor == Color.Empty) value.ForeColor = parent.ForeColor; // value.Parent = parent; //parent.arrList.Add(value); int i = List.Add(value as ListItem); if (parent != null) parent.RefreshItems(); //return i; return value; }
internal ListItem AddItem(ListItem item) { itemList.Add(item); this.Invalidate(); return item; }