var nodeElement = node.TreeViewElement.ViewElement.Children
.Cast<TreeNodeElement>()
.FirstOrDefault(c => c.Data == node);
if(nodeElement != null)
{
returnnodeElement.BoundingRectangle;
}
else
{
inty = 0;
RadTreeNode radTreeNode = node.TreeView.Nodes[0];
if(radTreeNode == null)
{
thrownewInvalidOperationException();
}
while(radTreeNode != node)
{
y += radTreeNode.ActualSize.Height;
radTreeNode = radTreeNode.NextVisibleNode;
}
intitemHeight = radTreeNode.ActualSize.Height;
var offset = node.TreeView.VScrollBar.Value;
Rectangle bounds = newRectangle(0, y - offset, node.TreeViewElement.Bounds.Width, itemHeight);
returnbounds;
}
}
0
Jack
Telerik team
answered on 25 May 2011, 05:30 AM
Hello Alex,
RadTreeView uses layered architecture and RadTreeNode is just a logical object. The user interfaces uses virtualization and creates visual elements only for the nodes that are currently visible on screen. This improves the performance and and lowers the memory usage. Only the visual element - TreeNodeElement has a BoundingRectangle property. Yes, your solution will do the job. However, please elaborate a bit more and describe what exactly you want to achieve. This will help me to understand the issue and find the best option.
I look forward to your reply.
Regards,
Jack
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.