BrightIdeasSoftware.ObjectListView.GetLastItemInDisplayOrder C# (CSharp) Méthode

GetLastItemInDisplayOrder() public méthode

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
Résultat 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

 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