protected override void OnPaint(PaintEventArgs e) { if (VirtualListSize == 0) { return; } int itemWidth = GetItemWidth(); int itemHeight = GetItemHeight(); int pagesize = (ClientSize.Height % itemHeight) == 0 ? (ClientSize.Height / itemHeight) : (ClientSize.Height / itemHeight) + 1; int startIndex = GetTopIndex(); int endIndex = Math.Min(startIndex + pagesize, VirtualListSize); Rectangle bound = new Rectangle(0, 0, itemWidth, itemHeight); for (int index = startIndex; index < endIndex; index++) { var re = new RetrieveCommandListItemEventArgs(index); OnRetrieveCommandListItem(re); re.Item.SetIndex(index); re.Item.SetBounds(bound); var de = new DrawCommandListItemEventArgs(e.Graphics, re.Item); OnDrawItem(de); bound.Y += itemHeight; } }
private void OnDrawItem(DrawCommandListItemEventArgs e) { DrawItem.Raise(this, e); }
protected override void OnPaint(PaintEventArgs e) { if (VirtualListSize == 0) return; int itemWidth = GetItemWidth(); int itemHeight = GetItemHeight(); int pagesize = (ClientSize.Height % itemHeight) == 0 ? (ClientSize.Height / itemHeight) : (ClientSize.Height / itemHeight) + 1; int startIndex = GetTopIndex(); int endIndex = Math.Min(startIndex+pagesize, VirtualListSize); Rectangle bound = new Rectangle(0, 0, itemWidth, itemHeight); for (int index = startIndex; index < endIndex; index++) { var re = new RetrieveCommandListItemEventArgs(index); OnRetrieveCommandListItem(re); re.Item.SetIndex(index); re.Item.SetBounds(bound); var de = new DrawCommandListItemEventArgs(e.Graphics,re.Item); OnDrawItem(de); bound.Y +=itemHeight; } }