Exemplo n.º 1
0
 public Rectangle GetBounds(TreeListViewItemBoundsPortion portion)
 {
     if (portion == TreeListViewItemBoundsPortion.PlusMinus)
     {
         if (TreeListView == null)
         {
             throw new Exception("This item is not associated with a TreeListView control");
         }
         Point location  = GetBounds(ItemBoundsPortion.Entire).Location;
         Point location2 = new Point(Level * SystemInformation.SmallIconSize.Width + 1 + location.X, TreeListView.GetItemRect(base.Index, ItemBoundsPortion.Entire).Top + 1);
         return(new Rectangle(location2, TreeListView.ShowPlusMinus ? SystemInformation.SmallIconSize : new Size(0, 0)));
     }
     return(GetBounds((ItemBoundsPortion)portion));
 }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves the specified portion of the bounding rectangle for the item
        /// </summary>
        /// <param name="portion">One of the TreeListViewItemBoundsPortion values that represents a portion of the item for which to retrieve the bounding rectangle</param>
        /// <returns>A Rectangle that represents the bounding rectangle for the specified portion of the item</returns>
        public Rectangle GetBounds(TreeListViewItemBoundsPortion portion)
        {
            switch ((int)portion)
            {
            case (int)TreeListViewItemBoundsPortion.PlusMinus:
                if (TreeListView == null)
                {
                    throw (new Exception("This item is not associated with a TreeListView control"));
                }
                Point pos      = base.GetBounds(ItemBoundsPortion.Entire).Location;
                Point position = new Point(
                    Level * SystemInformation.SmallIconSize.Width + 1 + pos.X,
                    TreeListView.GetItemRect(Index, ItemBoundsPortion.Entire).Top + 1);
                return(new Rectangle(position, TreeListView.ShowPlusMinus ? SystemInformation.SmallIconSize : new Size(0, 0)));

            default:
                ItemBoundsPortion lviPortion = (ItemBoundsPortion)(int)portion;
                return(base.GetBounds(lviPortion));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Retrieves the specified portion of the bounding rectangle for a specific item within the list view control
 /// </summary>
 /// <param name="index">The zero-based index of the item within the ListView.ListViewItemCollection whose bounding rectangle you want to return</param>
 /// <param name="portion">One of the TreeListViewItemBoundsPortion values that represents a portion of the TreeListViewItem for which to retrieve the bounding rectangle</param>
 /// <returns>A Rectangle that represents the bounding rectangle for the specified portion of the specified TreeListViewItem</returns>
 public Rectangle GetItemRect(int index, TreeListViewItemBoundsPortion portion)
 {
     if(index >= base.Items.Count || index < 0)
             throw(new Exception("Out of range exception"));
         TreeListViewItem item = (TreeListViewItem) base.Items[index];
         return item.GetBounds(portion);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Retrieves the specified portion of the bounding rectangle for the item
 /// </summary>
 /// <param name="portion">One of the TreeListViewItemBoundsPortion values that represents a portion of the item for which to retrieve the bounding rectangle</param>
 /// <returns>A Rectangle that represents the bounding rectangle for the specified portion of the item</returns>
 public Rectangle GetBounds(TreeListViewItemBoundsPortion portion)
 {
     switch ((int)portion)
     {
         case (int)TreeListViewItemBoundsPortion.PlusMinus:
             if (TreeListView == null)
                 throw (new Exception("This item is not associated with a TreeListView control"));
             Point pos = base.GetBounds(ItemBoundsPortion.Entire).Location;
             Point position = new Point(
                 Level * SystemInformation.SmallIconSize.Width + 1 + pos.X,
                 TreeListView.GetItemRect(Index, ItemBoundsPortion.Entire).Top + 1);
             return new Rectangle(position, TreeListView.ShowPlusMinus ? SystemInformation.SmallIconSize : new Size(0, 0));
         default:
             ItemBoundsPortion lviPortion = (ItemBoundsPortion)(int)portion;
             return base.GetBounds(lviPortion);
     }
 }