public FlatList() { Items = new FlatListItemList(this); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); }
internal void UpdateScrollbars() { if (_DrawSuspended) { return; } FlatListItemList flil = InItemList(); AutoScrollMinSize = new Size(1, flil.Count * GetItemSize().Height); }
protected override void OnPaint(PaintEventArgs e) { if (Parent is FlatArrowContainer) { // we only have to draw the background manually here if we're in a FlatArrowContainer e.Graphics.Clear(BackColor); } FlatListItemList flil = Items; if (!DesignMode) { FlatListItem fliInItem = InItem(); if (fliInItem != null) { flil = fliInItem.SubItems; if (!InItemLabel.Visible) { InItemLabel.Visible = true; InItemLabel.BackColor = _BorderColor; InItemLabel.ForeColor = ForeColor; InItemLabel.Height = _ItemHeight; InItemLabel.Left = this.Left; InItemLabel.Top = this.Top; this.Top = InItemLabel.Top + InItemLabel.Height; this.Height -= InItemLabel.Height; } InItemLabel.Text = " < " + fliInItem.Text; } else { if (InItemLabel.Visible) { InItemLabel.Visible = false; this.Top = InItemLabel.Top; this.Height += InItemLabel.Height; } } } e.Graphics.TranslateTransform(AutoScrollPosition.X, AutoScrollPosition.Y); for (int i = 0; i < flil.Count; i++) { DrawItem(i, flil[i], e); } base.OnPaint(e); }
public void PushInItemStack(int iItem) { if (iItem < 0) { throw new IndexOutOfRangeException(); } FlatListItemList flil = InItemList(); if (iItem >= flil.Count) { throw new IndexOutOfRangeException(); } InItemStack.Add(iItem); Invalidate(); UpdateScrollbars(); SelectedIndices = new int[] { }; }