Hi Stoyan,
We are using CustomShaped ShapeNode in our application. In this shape we have one TextRegion defined which is outer left side of the node that contains the text of the node. Defination of shape is: textAtTheLeft = new MindFusion.Diagramming.Wpf.Shape( Shapes.Rectangle.Outline,// reuse the rectangular shape null,// no decorations //Rohit: Perf changed new ElementTemplate[]// define text region { new LineTemplate(-300, 19, -50, 19), new LineTemplate(-50, 19, -50, 79), new LineTemplate(-50, 79, -300, 79), new LineTemplate(-300, 79, -300, 19) }, FillRule.EvenOdd,// doesn't matter here "textAtTheLeft"// to access the shape later using Shape.FromId );
Since we are assigning text at runtime so if text length is higher than the TextArea length then we want Either TextArea gets increase so that it can contain the whole text Or TextArea remain the same but text get wrapped and come in two or more lines.
We have tried to increase the TextArea at runtime but it has not solved our problem. We have tried with following snippet: Size size = diagram.MeasureString((node.Text, node, 600); double textAreaW = size.Width * 4; // the width of the text area
node.TextTrimming = TextTrimming.None; textAreaW = (-1 * textAreaW) - 240; node.Shape.TextArea = new ElementTemplate[] { new LineTemplate(textAreaW, 19, -50, 19), new LineTemplate(-50, 19, -50, 79), new LineTemplate(-50, 79, textAreaW, 79), new LineTemplate(textAreaW, 79, textAreaW, 19)}; node.TextAlignment = TextAlignment.Right; Please suggest to resolve this issue.
Regards, Bala
|