private void Draw(Graphics g) { if (null == g) { return; } g.Clear(this.BackColor); int startIndex = _pageIndex * _range.Row * _range.Col + _colIndex * _range.Row; int endIndex = (_pageIndex + 1) * _range.Row * _range.Col - 1; if (endIndex >= Items.Count) { endIndex = Items.Count - 1; } int x = 0, y = 0; for (int i = startIndex; i <= endIndex; i++) { x = (i - startIndex) / _range.Row; y = (i - startIndex) % _range.Row; ICustomDrawItem item = Items[i]; if (null != item) { int width = ItemWidth; if (width > Width) { width = Width; } int height = ItemHeight; if (height > Height) { height = Height; } if (i == SelectedtIndex) { using (SolidBrush brush = new SolidBrush(Color.SkyBlue)) { g.FillRectangle(brush, x * (ItemWidth + ItemColPadding) + 1, y * (ItemHeight + ItemRowPadding) + 1, width - 2, height - 2); } } item.Draw(g, x * (ItemWidth + ItemColPadding), y * (ItemHeight + ItemRowPadding), width - 2, height - 2); } } }
public void RemoveItem(ICustomDrawItem item) { Items.Remove(item); SetVScrollBarValue(); SetHScrollBarValue(); }
public void RemoveItem(ICustomDrawItem item) { _list.RemoveItem(item); }
public void AddItem(ICustomDrawItem item) { Items.Add(item); SetVScrollBarValue(); SetHScrollBarValue(); }
public void AddItem(ICustomDrawItem item) { _list.AddItem(item); }