Sometimes labels are drawn outside my symbol. Why?
Sometimes labels are drawn outside my symbol. Why?
When you add a label to your symbol and specify its anchor using the BoxPosition Enumeration, you need to remember that the label's anchor point will be its center. Therefore, by specifying BoxPosition.TopLeft, you are setting the center/anchor point of the label to be the top left of your symbol. To ensure that the label text is within the symbol, you should set appropriate offsets, such as if you want the label to begin at the top left of your symbol:
[C#]
// Add new label to MySymbol Label lbl = AddLabel("My Symbol", BoxPosition.TopLeft);
// Offsets for the label lbl.OffsetX = this.lbl.Width/2; lbl.OffsetY = this.lbl.Height/2;
[VB.NET]
'Add new label to MySymbol Dim lbl As Label = AddLabel("My Symbol",BoxPosition.TopLeft) 'Offsets for the label lbl.OffsetX = Me.lbl.Width/2 lbl.OffsetY = Me.lbl.Height/2
I hope you enjoyed learning about why Sometimes labels are drawn outside my symbol.
You can refer to our WinForms Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our
WinForms Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to SyncfusionĀ®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!