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. Image for the cookie policy date
close icon

Alignment of lebel to TOP Left

Hi,

I am using the sync fusion diagram control version (7.3.0.20)

I am using the symbol rectangle, in that symbol I want to add text so, I add label to that symbol and assign the text to that label.

Code e.g.

SymbolRectangle SymbolRectInput = new SymbolRectangle();

SymbolRectInput.Size = new SizeF(SymbolWidth, symbolHeight);

Syncfusion.Windows.Forms.Diagram.Label lblnameInput = new Syncfusion.Windows.Forms.Diagram.Label();

SymbolRectInput.Labels.Add(lblnameInput);

this.diagram.Model.AppendChild(SymbolRectInput);

SymbolRectInput.Labels[0].Text = strtextName;


Problem:-

Label of Text in Symbol is Center align. But I want that to Top Left align
Please help me, how to align label text to top left in symbol rectangle.






Aling Text_8ccc4449.zip

1 Reply

GM Gowri Manohari D Syncfusion Team September 10, 2009 03:59 AM UTC


Hi Nikhil,

Thank you for choosing Syncfusion products.

Diagram label supports the Position property in order to position the label inside the node. Please refer the code snippet for more details.


Syncfusion.Windows.Forms.Diagram.Rectangle rect = new Syncfusion.Windows.Forms.Diagram.
Rectangle(50, 50, 150, 250);
Syncfusion.Windows.Forms.Diagram.Label lbl = new Syncfusion.Windows.Forms.Diagram.Label();
lbl.Text = "This is First";
lbl.Position = Position.TopLeft; //Position the label
lbl.UpdatePosition = true;
rect.Labels.Add(lbl);

Here lbl.UpdatePosition property will position the label at exact location.

Regards,
Gowri

Loader.
Live Chat Icon For mobile
Up arrow icon