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
Esempio n. 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);
             }
         }
     }
 }
Esempio n. 2
0
        public override void Draw(ObjectListView olv, Graphics g, Rectangle r)
        {
            // This overlay only works when:
            // - the list is in Details view
            // - there is at least one row
            // - there is a selected column
            if (olv.View != System.Windows.Forms.View.Details)
            {
                return;
            }

            if (olv.GetItemCount() == 0)
            {
                return;
            }

            OLVColumn column = this.ColumnToTint ?? olv.SelectedColumn;

            if (column == null)
            {
                return;
            }

            Point sides = NativeMethods.GetScrolledColumnSides(olv, column.Index);

            if (sides.X == -1)
            {
                return;
            }

            Rectangle columnBounds = new Rectangle(sides.X, r.Top, sides.Y - sides.X, r.Bottom);

            // Find the bottom of the last item. The tinting should extend only to there.
            OLVListItem lastItem = olv.GetLastItemInDisplayOrder();

            if (lastItem != null)
            {
                Rectangle lastItemBounds = lastItem.Bounds;
                if (!lastItemBounds.IsEmpty && lastItemBounds.Bottom < columnBounds.Bottom)
                {
                    columnBounds.Height = lastItemBounds.Bottom - columnBounds.Top;
                }
            }
            g.FillRectangle(this.tintBrush, columnBounds);
        }
Esempio n. 3
0
        /// <summary>
        /// Draw a decoration over our  column
        /// </summary>
        /// <remarks>
        /// This overlay only works when:
        /// - the list is in Details view
        /// - there is at least one row
        /// - there is a selected column (or a specified tint column)
        /// </remarks>
        /// <param name="olv"></param>
        /// <param name="g"></param>
        /// <param name="r"></param>
        public override void Draw(ObjectListView olv, Graphics g, Rectangle r)
        {
            if (olv.View != System.Windows.Forms.View.Details)
            {
                return;
            }

            if (olv.GetItemCount() == 0)
            {
                return;
            }

            if (this.ColumnToDecorate == null)
            {
                return;
            }

            Point sides = NativeMethods.GetScrolledColumnSides(olv, this.ColumnToDecorate.Index);

            if (sides.X == -1)
            {
                return;
            }

            Rectangle columnBounds = new Rectangle(sides.X, r.Top, sides.Y - sides.X, r.Bottom);

            // Find the bottom of the last item. The decoration should extend only to there.
            OLVListItem lastItem = olv.GetLastItemInDisplayOrder();

            if (lastItem != null)
            {
                Rectangle lastItemBounds = lastItem.Bounds;
                if (!lastItemBounds.IsEmpty && lastItemBounds.Bottom < columnBounds.Bottom)
                {
                    columnBounds.Height = lastItemBounds.Bottom - columnBounds.Top;
                }
            }

            // Delegate the drawing of the actual decoration
            this.DrawDecoration(olv, g, r, columnBounds);
        }
Esempio n. 4
0
        /// <summary>
        /// Draw a slight colouring over our tinted column
        /// </summary>
        /// <remarks>
        /// This overlay only works when:
        /// - the list is in Details view
        /// - there is at least one row
        /// - there is a selected column (or a specified tint column)
        /// </remarks>
        /// <param name="olv"></param>
        /// <param name="g"></param>
        /// <param name="r"></param>
        public override void Draw(ObjectListView olv, Graphics g, Rectangle r)
        {
            if (olv.View != View.Details)
            {
                return;
            }

            if (olv.GetItemCount() == 0)
            {
                return;
            }

            OLVColumn column = ColumnToTint ?? olv.SelectedColumn;

            if (column == null)
            {
                return;
            }

            Point sides = NativeMethods.GetScrolledColumnSides(olv, column.Index);

            if (sides.X == -1)
            {
                return;
            }

            var columnBounds = new Rectangle(sides.X, r.Top, sides.Y - sides.X, r.Bottom);

            // Find the bottom of the last item. The tinting should extend only to there.
            OLVListItem lastItem = olv.GetLastItemInDisplayOrder();

            if (lastItem != null)
            {
                Rectangle lastItemBounds = lastItem.Bounds;
                if (!lastItemBounds.IsEmpty && lastItemBounds.Bottom < columnBounds.Bottom)
                {
                    columnBounds.Height = lastItemBounds.Bottom - columnBounds.Top;
                }
            }
            g.FillRectangle(tintBrush, columnBounds);
        }
Esempio n. 5
0
        /// <summary>
        /// Draw a slight colouring over our tinted column
        /// </summary>
        /// <remarks>
        /// This overlay only works when:
        /// - the list is in Details view
        /// - there is at least one row
        /// - there is a selected column (or a specified tint column)
        /// </remarks>
        /// <param name="olv"></param>
        /// <param name="g"></param>
        /// <param name="r"></param>
        public override void Draw(ObjectListView olv, Graphics g, Rectangle r)
        {
            if (olv.View != View.Details)
                return;

            if (olv.GetItemCount() == 0)
                return;

            OLVColumn column = ColumnToTint ?? olv.SelectedColumn;
            if (column == null)
                return;

            Point sides = NativeMethods.GetScrolledColumnSides(olv, column.Index);
            if (sides.X == -1)
                return;

            var columnBounds = new Rectangle(sides.X, r.Top, sides.Y - sides.X, r.Bottom);

            // Find the bottom of the last item. The tinting should extend only to there.
            OLVListItem lastItem = olv.GetLastItemInDisplayOrder();
            if (lastItem != null)
            {
                Rectangle lastItemBounds = lastItem.Bounds;
                if (!lastItemBounds.IsEmpty && lastItemBounds.Bottom < columnBounds.Bottom)
                    columnBounds.Height = lastItemBounds.Bottom - columnBounds.Top;
            }
            g.FillRectangle(tintBrush, columnBounds);
        }
Esempio n. 6
0
        public void Draw(ObjectListView olv, Graphics g, Rectangle r)
        {
            // This overlay only works when:
            // - the list is in Details view
            // - there is at least one row
            // - there is a selected column
            if (olv.View != System.Windows.Forms.View.Details)
                return;

            if (olv.GetItemCount() == 0)
                return;

            OLVColumn column = this.ColumnToTint ?? olv.SelectedColumn;
            if (column == null)
                return;

            Point sides = NativeMethods.GetColumnSides(olv, column.Index);
            if (sides.X == -1)
                return;

            Rectangle columnBounds = new Rectangle(sides.X, r.Top, sides.Y - sides.X, r.Bottom);

            // Find the bottom of the last item
            Rectangle lastItemBounds = olv.GetLastItemInDisplayOrder().Bounds;
            if (lastItemBounds.Bottom < columnBounds.Bottom)
                columnBounds.Height = lastItemBounds.Bottom - columnBounds.Top;
            g.FillRectangle(this.tintBrush, columnBounds);
        }