Back to Devexpress

TreeMapControl.GetItemBounds(ITreeMapItem) Method

windowsforms-devexpress-dot-xtratreemap-dot-treemapcontrol-dot-getitembounds-x28-devexpress-dot-treemap-dot-itreemapitem-x29.md

latest2.2 KB
Original Source

TreeMapControl.GetItemBounds(ITreeMapItem) Method

Returns a Rectangle object that defines the location of an item passed as a parameter.

Namespace : DevExpress.XtraTreeMap

Assembly : DevExpress.XtraTreeMap.v25.2.UI.dll

NuGet Package : DevExpress.Win.TreeMap

Declaration

csharp
public Rectangle GetItemBounds(
    ITreeMapItem item
)
vb
Public Function GetItemBounds(
    item As ITreeMapItem
) As Rectangle

Parameters

NameTypeDescription
itemITreeMapItem

A TreeMap item whose location is returned.

|

Returns

TypeDescription
Rectangle

A Rectangle object that defines the TreeMap item’s location.

|

Remarks

The following code displays TreeMap item dimensions in item labels:

csharp
foreach (ITreeMapItem myItem in treeMap.DataAdapter.Items) {
  TreeMapItem treeMapItem = (TreeMapItem)myItem;
  Rectangle rect = treeMap.GetItemBounds(myItem);
  treeMapItem.Label = String.Format("Width:{0}, Height:{1}", rect.Width.ToString(), rect.Height.ToString());
}
vb
For Each myItem As ITreeMapItem In treeMap.DataAdapter.Items
  Dim treeMapItem As TreeMapItem = CType(myItem, TreeMapItem)
  Dim rect As Rectangle = treeMap.GetItemBounds(myItem)
  treeMapItem.Label = String.Format("Width: {0}, Height: {1}", rect.Width.ToString(), rect.Height.ToString())
Next

See Also

TreeMapControl Class

TreeMapControl Members

DevExpress.XtraTreeMap Namespace