Hi Songjian,
Thanks for your interest in Syncfusion products.
We suggest you to use the TextNode.BoundingRectangle’s ‘Width and Height’ properties to get height and width of the node respectively and use TextNode.FontStyle’s ‘Size’ property to get the size of the font in TextNode. Please refer the below code snippet to achieve your requirement.
Here is the code:
[C#]
//Getting TextNode's properties in ButtonClick
private void button1_Click(object sender, EventArgs e)
{
if (diagram1.View.SelectionList.Count != 0)
{
foreach (Node node in diagram1.View.SelectionList)
{
if (node is TextNode)
{
float width = ((TextNode)node).BoundingRectangle.Width;
float height = ((TextNode)node).BoundingRectangle.Height;
float fntSize = ((TextNode)node).FontStyle.Size;
MessageBox.Show("Width:" + width + " " + "Height:" + height + " " + "Font Size:" + fntSize);
}
}
}
else
MessageBox.Show("Please select a TextNode");
}
Here is the Sample:
ForumGetTextNodeProp53894176.zipPlease try the above sample and let us know if you have any queries.
Regards,
Amsath Ali. M