public void AddItemToTop(WarframeListBoxItem item) { this.SafeInvoke(() => { Items.Insert(0, item); }); }
public void AddItemToBottom(WarframeListBoxItem item) { this.SafeInvoke(() => { Items.Add(item); }); }
protected override void OnDrawItem(DrawItemEventArgs e) { if (Items.Count <= e.Index) { return; } WarframeListBoxItem item = Items[e.Index] as WarframeListBoxItem; if (item == null) { return; } if (!drawingInitialized) { InitializeDrawing(e); } SolidBrush backgroundBrush = e.Index % 2 == 0 ? backgroundAlphaBrush : backgroundBetaBrush; SolidBrush foregroundBrush = item.faded ? textBrushFaded : textBrushSolid; e.DrawBackground(); e.Graphics.FillRectangle(backgroundBrush, e.Bounds); e.Graphics.DrawString(item.text, e.Font, foregroundBrush, e.Bounds); e.DrawFocusRectangle(); }
public void RemoveItem(WarframeListBoxItem item) { this.SafeInvoke(() => { RemoveItem(item.tag); }); }
protected override void OnMeasureItem(MeasureItemEventArgs e) { if (Items.Count <= e.Index) { return; } WarframeListBoxItem item = Items[e.Index] as WarframeListBoxItem; if (item == null) { return; } int realWidth = Width - SystemInformation.VerticalScrollBarWidth; e.ItemHeight = (int)e.Graphics.MeasureString(item.text, Font, realWidth).Height; }
public void RemoveItem(string tag) { this.SafeInvoke(() => { for (int i = Items.Count - 1; i >= 0; --i) { WarframeListBoxItem item = Items[i] as WarframeListBoxItem; if (item == null) { continue; } if (item.tag == tag) { Items.RemoveAt(i); } } }); }