We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Alignment textnode doesn't work

Thread ID:

Created:

Updated:

Platform:

Replies:

131224 Jun 29,2017 04:40 AM Jul 12,2017 05:22 AM Windows Forms 11
loading
Tags: Diagram
Blanca Calderon
Asked On June 29, 2017 04:40 AM

Hi,


I don't understand how the alignment works. If I create 3 textnodes in different possitions and I try to align left the three of then nothing happens. I would like that work like word tool, if you want to align to the left all selected nodes are shifted to the left.

Any ideas? 

Blanca


Naganathan Ganesh Babu [Syncfusion]
Replied On June 30, 2017 02:11 AM

Hi Blanca, 
 
Thanks for contacting Syncfusion support. 
 
In diagram Control, Alignment works based on Diagram.Model’s “AlignmentType” property and it has two types and its explained in below, 
 
1.      SelectedNode – it used to align the node based on the position of the first node contains SelectionList.  
For example:  
If the diagram contains 3 text nodes i.e. TextNode1, TextNode2 and TextNode3.  In the Diagram.View’s “SelectionList” contains the First Node is TextNode2. Then the others nodes aligned based on the TextNode2’s position.  
 
2.      BoundingRectangle. – it is used to align the nodes based on the total bounds area of the selected nodes.  
 
Please refer to the below code example and attached video.  
 
Code example: 
 
[C#] 
 
//Set whether the align the nodes based on the Selected node or selected Bounds area. 
diagram1.Model.AlignmentType = AlignmentType.SelectedNode; 
 
Video: 
 
 
Regards, 
 
Naganathan K G 


Blanca Calderon
Replied On June 30, 2017 04:10 AM

Hi Blanca, 
 
Thanks for contacting Syncfusion support. 
 
In diagram Control, Alignment works based on Diagram.Model’s “AlignmentType” property and it has two types and its explained in below, 
 
1.      SelectedNode – it used to align the node based on the position of the first node contains SelectionList.  
For example:  
If the diagram contains 3 text nodes i.e. TextNode1, TextNode2 and TextNode3.  In the Diagram.View’s “SelectionList” contains the First Node is TextNode2. Then the others nodes aligned based on the TextNode2’s position.  
 
2.      BoundingRectangle. – it is used to align the nodes based on the total bounds area of the selected nodes.  
 
Please refer to the below code example and attached video.  
 
Code example: 
 
[C#] 
 
//Set whether the align the nodes based on the Selected node or selected Bounds area. 
diagram1.Model.AlignmentType = AlignmentType.SelectedNode; 
 
Video: 
 
 
Regards, 
 
Naganathan K G 


Thank you for your answer but for me it doesn't work. I will send you a video.


Attachment: Video_1498816965_fb8814e7.zip

Naganathan Ganesh Babu [Syncfusion]
Replied On July 3, 2017 02:24 AM

Hi Blanca, 
 
We are unable reproduce reported issue at our end. please check the below attached sample and let us know the reported issue reproduced or not? Also, provide us the version in which the reported issue is reproduced.  
 
Sample: 
 
 
Regards, 
 
Naganathan K G 


Blanca Calderon
Replied On July 3, 2017 02:42 AM

I couldn't open the sample, the dll's are in different version. My version is 13.4200.0.53


Naganathan Ganesh Babu [Syncfusion]
Replied On July 3, 2017 02:52 AM

Hi Blanca, 
 
Sorry for the inconvenience caused. 
 
We have modified and attached the sample in the below link with framework version 2.0 as per your request. 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 


Blanca Calderon
Replied On July 3, 2017 05:34 AM

I don't have problems with rectangle, or lines, I have problems with textnode.


Blanca Calderon
Replied On July 3, 2017 06:32 AM

I'm thinking is because of the textnode size or alignment of the text or something similar, i don't know why.


Blanca Calderon
Replied On July 3, 2017 06:46 AM

And I don't have problem when I append a textnode, example:


 Syncfusion.Windows.Forms.Diagram.TextNode rect2 = new Syncfusion.Windows.Forms.Diagram.TextNode("pruebapuuuu"); //.Rectangle(100, 50, 100, 50);          diagram1.Model.AppendChild(rect2);

I have problems when I use texttool. 


         


Naganathan Ganesh Babu [Syncfusion]
Replied On July 4, 2017 05:11 AM

Hi Blanca, 
 
We have created and verified a sample by drawing a TextNode using TextTool. But still we are unable to reproduce the reported issue at our end. please refer to the below attached sample.  
 
Sample: 
 
 
Please confirm us whether you have done any customization on the Diagram’s TextNode/TextTool class to draw the TextNode? if so, please share your customized code example for creating the TextNode using TextTool, which will help us to analyze further and provide a better solution. 
 
Regards, 
 
Naganathan K G 


Blanca Calderon
Replied On July 10, 2017 04:55 AM

The problem is when you align right and the linestyle color is transparent. Obviously the alignment is correct but, if you don't see the line it's weird. In my case the line in a textbox is always transparent.


Naganathan Ganesh Babu [Syncfusion]
Replied On July 12, 2017 05:22 AM

Hi Blanca, 
 
In Diagram control, the alignment of node is based on the size of the diagram’s nodes not based on the given text size. So, we suggest you to modify the textnode’s size manually based on the given text to achieve your requirement. please refer to the below modified sample and code example in order to change the textnode’s size automatically based on the given text. 
 
Code example: 
 
[C#] 
 
private void AutoNodeSizeChange(TextEditor textEditor) 
{ 
if (diagram1.View.SelectionList.Count == 1 && diagram1.View.SelectionList[0] is TextNode) 
{ 
using (Graphics graphics = diagram1.CreateGraphics()) 
{ 
string currentTxt = textEditor.Text;                    
SizeF stringSize = new SizeF(); 
TextNode txtnode = diagram1.View.SelectionList[0] as TextNode; 
stringSize = graphics.MeasureString(currentTxt, new Font(txtnode.FontStyle.Family, txtnode.FontStyle.Size)); 
txtnode.Size = stringSize; 
txtnode.PinPointOffset = new SizeF(stringSize.Width / 2, stringSize.Height / 2); 
} 
} 
} 
 
Sample: 
 
 
Regards, 
 
Naganathan K G 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;