Exemplo n.º 1
0
 public void AddItemToTop(WarframeListBoxItem item)
 {
     this.SafeInvoke(() =>
     {
         Items.Insert(0, item);
     });
 }
Exemplo n.º 2
0
 public void AddItemToBottom(WarframeListBoxItem item)
 {
     this.SafeInvoke(() =>
     {
         Items.Add(item);
     });
 }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
 public void RemoveItem(WarframeListBoxItem item)
 {
     this.SafeInvoke(() =>
     {
         RemoveItem(item.tag);
     });
 }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        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);
                    }
                }
            });
        }