/// <summary> /// Retrieves the specified portion of the bounding rectangle for a specific item within the list view control. /// </summary> /// <param name="listView">The <see cref="ListView"/> control.</param> /// <param name="index">The zero-based index of the item within the <see cref="ListView.ListViewItemCollection"/> whose bounding rectangle you want to return.</param> /// <param name="portion">One of the <see cref="ItemBoundsPortion"/> values that represents a portion of the <see cref="ListViewItem"/> for which to retrieve the bounding rectangle.</param> /// <returns>A <see cref="Rectangle"/> that represents the bounding rectangle for the specified portion of the specified <see cref="ListViewItem"/>.</returns> public static Rectangle GetItemRect(this ListView listView, int index, ItemBoundsPortion portion) { RECT r = new RECT(); r.left = (int)portion; int result = NativeMethods.SendMessage(listView.Handle, LVM_GETITEMRECT, index, ref r); return(r.ToRectangle()); }
public Rectangle GetBounds(ItemBoundsPortion portion) { if (listView != null) { return(listView.GetItemRect(Index, portion)); } else { return(Rectangle.Empty); } }
/// <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)); } }
public Rectangle GetItemRect(int index, ItemBoundsPortion portion) { return Rectangle.Empty; }
/// <include file='doc\ListViewItem.uex' path='docs/doc[@for="ListViewItem.GetBounds"]/*' /> /// <devdoc> /// Returns a specific portion of the ListViewItem's bounding rectangle. /// The rectangle returned is empty if the ListViewItem has not been added to a ListView control. /// </devdoc> public Rectangle GetBounds(ItemBoundsPortion portion) { if (listView != null && listView.IsHandleCreated) { return listView.GetItemRect(Index, portion); } else return new Rectangle(); }
internal Rectangle GetSubItemRect(int itemIndex, int subItemIndex, ItemBoundsPortion portion) { if (this.View != System.Windows.Forms.View.Details) { return Rectangle.Empty; } if ((itemIndex < 0) || (itemIndex >= this.Items.Count)) { throw new ArgumentOutOfRangeException("itemIndex", System.Windows.Forms.SR.GetString("InvalidArgument", new object[] { "itemIndex", itemIndex.ToString(CultureInfo.CurrentCulture) })); } int count = this.Items[itemIndex].SubItems.Count; if ((subItemIndex < 0) || (subItemIndex >= count)) { throw new ArgumentOutOfRangeException("subItemIndex", System.Windows.Forms.SR.GetString("InvalidArgument", new object[] { "subItemIndex", subItemIndex.ToString(CultureInfo.CurrentCulture) })); } if (!System.Windows.Forms.ClientUtils.IsEnumValid(portion, (int) portion, 0, 3)) { throw new InvalidEnumArgumentException("portion", (int) portion, typeof(ItemBoundsPortion)); } if (this.Columns.Count == 0) { return Rectangle.Empty; } System.Windows.Forms.NativeMethods.RECT lparam = new System.Windows.Forms.NativeMethods.RECT { left = (int) portion, top = subItemIndex }; if (((int) ((long) base.SendMessage(0x1038, itemIndex, ref lparam))) == 0) { throw new ArgumentException(System.Windows.Forms.SR.GetString("InvalidArgument", new object[] { "itemIndex", itemIndex.ToString(CultureInfo.CurrentCulture) })); } return Rectangle.FromLTRB(lparam.left, lparam.top, lparam.right, lparam.bottom); }
public System.Drawing.Rectangle GetItemRect(int index, ItemBoundsPortion portion) {}
///<summary> ///Retrieves the specified portion of the bounding rectangle for a specific item within the list view control. ///</summary> /// ///<returns> ///A <see cref="T:System.Drawing.Rectangle"></see> that represents the bounding rectangle for the specified portion of the specified <see cref="T:System.Windows.Forms.ListViewItem"></see>. ///</returns> /// ///<param name="portion">One of the <see cref="T:System.Windows.Forms.ItemBoundsPortion"></see> values that represents a portion of the <see cref="T:System.Windows.Forms.ListViewItem"></see> for which to retrieve the bounding rectangle. </param> ///<param name="index">The zero-based index of the item within the <see cref="T:System.Windows.Forms.ListView.ListViewItemCollection"></see> whose bounding rectangle you want to return. </param><filterpriority>1</filterpriority><PermissionSet><IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" /><IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /></PermissionSet> public Rectangle GetItemRect(int index, ItemBoundsPortion portion) { return shortcutList.GetItemRect(index, portion); }
public System.Drawing.Rectangle GetBounds(ItemBoundsPortion portion) {}
public Rectangle GetBounds(ItemBoundsPortion portion) { throw null; }
public Rectangle GetBounds (ItemBoundsPortion portion) { if (owner == null) return Rectangle.Empty; Rectangle rect; switch (portion) { case ItemBoundsPortion.Icon: rect = icon_rect; break; case ItemBoundsPortion.Label: rect = label_rect; break; case ItemBoundsPortion.ItemOnly: rect = item_rect; break; case ItemBoundsPortion.Entire: rect = bounds; break; default: throw new ArgumentException ("Invalid value for portion."); } Point item_loc = owner.GetItemLocation (DisplayIndex); rect.X += item_loc.X; rect.Y += item_loc.Y; return rect; }
///<summary> ///Retrieves the specified portion of the bounding rectangle for a specific item within the list view control. ///</summary> /// ///<returns> ///A <see cref="T:System.Drawing.Rectangle"></see> that represents the bounding rectangle for the specified portion of the specified <see cref="T:System.Windows.Forms.ListViewItem"></see>. ///</returns> /// ///<param name="portion">One of the <see cref="T:System.Windows.Forms.ItemBoundsPortion"></see> values that represents a portion of the <see cref="T:System.Windows.Forms.ListViewItem"></see> for which to retrieve the bounding rectangle. </param> ///<param name="index">The zero-based index of the item within the <see cref="T:System.Windows.Forms.ListView.ListViewItemCollection"></see> whose bounding rectangle you want to return. </param><filterpriority>1</filterpriority><PermissionSet><IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /><IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" /><IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /></PermissionSet> public Rectangle GetItemRect(int index, ItemBoundsPortion portion) { return(shortcutList.GetItemRect(index, portion)); }
public Rectangle GetBounds(ItemBoundsPortion portion) { if ((this.listView != null) && this.listView.IsHandleCreated) { return this.listView.GetItemRect(this.Index, portion); } return new Rectangle(); }
public Rectangle GetBounds (ItemBoundsPortion portion) { if (owner == null) return Rectangle.Empty; Rectangle rect; #if NET_2_0 // Call Layout if bounds haven't been computed. // since we can get different item instances at each invocation if (owner.VirtualMode && bounds == Rectangle.Empty) Layout (); #endif switch (portion) { case ItemBoundsPortion.Icon: rect = icon_rect; break; case ItemBoundsPortion.Label: rect = label_rect; break; case ItemBoundsPortion.ItemOnly: rect = item_rect; break; case ItemBoundsPortion.Entire: rect = bounds; break; default: throw new ArgumentException ("Invalid value for portion."); } Point item_loc = owner.GetItemLocation (DisplayIndex); rect.X += item_loc.X; rect.Y += item_loc.Y; return rect; }
/// <include file='doc\ListView.uex' path='docs/doc[@for="ListView.GetItemRect1"]/*' /> /// <devdoc> /// Returns a specific portion of a list item's bounding rectangle. /// </devdoc> public Rectangle GetItemRect(int index, ItemBoundsPortion portion) { if (index < 0 || index >= this.Items.Count) { throw new ArgumentOutOfRangeException("index", SR.GetString(SR.InvalidArgument, "index", (index).ToString(CultureInfo.CurrentCulture))); } //valid values are 0x0 to 0x3 if (!ClientUtils.IsEnumValid(portion, (int)portion, (int)ItemBoundsPortion.Entire, (int)ItemBoundsPortion.ItemOnly)){ throw new InvalidEnumArgumentException("portion", (int)portion, typeof(ItemBoundsPortion)); } if (this.View == View.Details && this.Columns.Count == 0) { return Rectangle.Empty; } NativeMethods.RECT itemrect = new NativeMethods.RECT(); itemrect.left = (int)portion; if (unchecked( (int) (long)SendMessage(NativeMethods.LVM_GETITEMRECT, index, ref itemrect)) == 0) throw new ArgumentException(SR.GetString(SR.InvalidArgument, "index", (index).ToString(CultureInfo.CurrentCulture))); return Rectangle.FromLTRB(itemrect.left, itemrect.top, itemrect.right, itemrect.bottom); }
public System.Drawing.Rectangle GetItemRect(int index, ItemBoundsPortion portion) { }
internal Rectangle GetSubItemRect(int itemIndex, int subItemIndex, ItemBoundsPortion portion) { // it seems that getting the rectangle for a sub item only works for list view which are in Details view if (this.View != View.Details) { return Rectangle.Empty; } if (itemIndex < 0 || itemIndex >= this.Items.Count) { throw new ArgumentOutOfRangeException("itemIndex", SR.GetString(SR.InvalidArgument, "itemIndex", (itemIndex).ToString(CultureInfo.CurrentCulture))); } int subItemCount = Items[itemIndex].SubItems.Count; if (subItemIndex < 0 || subItemIndex >= subItemCount) { throw new ArgumentOutOfRangeException("subItemIndex", SR.GetString(SR.InvalidArgument, "subItemIndex", (subItemIndex).ToString(CultureInfo.CurrentCulture))); } //valid values are 0x0 to 0x3 if (!ClientUtils.IsEnumValid(portion, (int)portion, (int)ItemBoundsPortion.Entire, (int)ItemBoundsPortion.ItemOnly)) { throw new InvalidEnumArgumentException("portion", (int)portion, typeof(ItemBoundsPortion)); } if (this.Columns.Count == 0) { return Rectangle.Empty; } NativeMethods.RECT itemrect = new NativeMethods.RECT(); itemrect.left = (int)portion; itemrect.top = subItemIndex; if (unchecked( (int) (long)SendMessage(NativeMethods.LVM_GETSUBITEMRECT, itemIndex, ref itemrect)) == 0) throw new ArgumentException(SR.GetString(SR.InvalidArgument, "itemIndex", (itemIndex).ToString(CultureInfo.CurrentCulture))); Rectangle result = Rectangle.FromLTRB(itemrect.left, itemrect.top, itemrect.right, itemrect.bottom); return result; }
public System.Drawing.Rectangle GetBounds(ItemBoundsPortion portion) { }
public Rectangle GetItemRect (int index, ItemBoundsPortion portion) { if (index < 0 || index >= items.Count) throw new IndexOutOfRangeException ("index"); return items [index].GetBounds (portion); }
public Rectangle GetBounds(ItemBoundsPortion portion) { if (listView != null) { return listView.GetItemRect(Index, portion); } else { return Rectangle.Empty; } }
private Rectangle CalculateCellBounds(OLVListItem item, int subItemIndex, ItemBoundsPortion portion) { // SubItem.Bounds works for every subitem, except the first. if (subItemIndex > 0) return item.SubItems[subItemIndex].Bounds; // For non detail views, we just use the requested portion Rectangle r = this.GetItemRect(item.Index, portion); if (r.Y < -10000000 || r.Y > 10000000) { r.Y = item.Bounds.Y; } if (this.View != View.Details) return r; // Finding the bounds of cell 0 should not be a difficult task, but it is. Problems: // 1) item.SubItem[0].Bounds is always the full bounds of the entire row, not just cell 0. // 2) if column 0 has been dragged to some other position, the bounds always has a left edge of 0. // We avoid both these problems by using the position of sides the column header to calculate // the sides of the cell Point sides = NativeMethods.GetScrolledColumnSides(this, 0); r.X = sides.X + 4; r.Width = sides.Y - sides.X - 5; return r; }
public Rectangle GetItemRect(int index, ItemBoundsPortion portion) { throw null; }