BrightIdeasSoftware.ObjectListView.GetLastItemInDisplayOrder C# (CSharp) Method

GetLastItemInDisplayOrder() public method

Return the last item in the order they are shown to the user. If the control is not grouped, the display order is the same as the sorted list order. But if the list is grouped, the display order is different.
public GetLastItemInDisplayOrder ( ) : OLVListItem
return OLVListItem
        public virtual OLVListItem GetLastItemInDisplayOrder()
        {
            if (!this.ShowGroups)
                return this.GetItem(this.GetItemCount() - 1);

            if (this.Groups.Count > 0) {
                ListViewGroup lastGroup = this.Groups[this.Groups.Count - 1];
                if (lastGroup.Items.Count > 0)
                    return (OLVListItem)lastGroup.Items[lastGroup.Items.Count - 1];
            }

            return null;
        }

Usage Example

Beispiel #1
0
 public override void Draw(ObjectListView olv, Graphics g, Rectangle r)
 {
     if ((olv.View == View.Details) && (olv.GetItemCount() != 0))
     {
         OLVColumn column = this.ColumnToTint ?? olv.SelectedColumn;
         if (column != null)
         {
             Point scrolledColumnSides = BrightIdeasSoftware.NativeMethods.GetScrolledColumnSides(olv, column.Index);
             if (scrolledColumnSides.X != -1)
             {
                 Rectangle   rect = new Rectangle(scrolledColumnSides.X, r.Top, scrolledColumnSides.Y - scrolledColumnSides.X, r.Bottom);
                 OLVListItem lastItemInDisplayOrder = olv.GetLastItemInDisplayOrder();
                 if (lastItemInDisplayOrder != null)
                 {
                     Rectangle bounds = lastItemInDisplayOrder.Bounds;
                     if (!(bounds.IsEmpty || (bounds.Bottom >= rect.Bottom)))
                     {
                         rect.Height = bounds.Bottom - rect.Top;
                     }
                 }
                 g.FillRectangle(this.tintBrush, rect);
             }
         }
     }
 }
All Usage Examples Of BrightIdeasSoftware.ObjectListView::GetLastItemInDisplayOrder
ObjectListView