Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
 public void RemoveItem(ICustomDrawItem item)
 {
     Items.Remove(item);
     SetVScrollBarValue();
     SetHScrollBarValue();
 }
Beispiel #3
0
 public void RemoveItem(ICustomDrawItem item)
 {
     _list.RemoveItem(item);
 }
Beispiel #4
0
 public void AddItem(ICustomDrawItem item)
 {
     Items.Add(item);
     SetVScrollBarValue();
     SetHScrollBarValue();
 }
Beispiel #5
0
 public void AddItem(ICustomDrawItem item)
 {
     _list.AddItem(item);
 }