The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Currently my application adds my custom symbol to the diagram from the palette. This symbol contains 2 labels which I added in Symbol Designer.
My goal is to add my own labels to the symbol when it has been added to the diagram. Currently I have had no joy so instead am trying to clear the existing labels. When the user clicks a button then the following code is invoked:
private void btnAddLabel_Click(object sender, System.EventArgs e)
{
DiagramForm frm = (DiagramForm)ActiveMdiChild;
foreach (Symbol sym in frm.Diagram.Model.Nodes)
{
foreach (Label lbl in sym.Labels)
MessageBox.Show(lbl.Text);
sym.Labels.Clear();
}
However, the labels are not removed from the screen. When I inspect the Labels property of the Symbol there are no labels.
Should I be calling another method to refresh the diagram? I have tried each of the following afterwards but to no avail.
frm.Diagram.Refresh();
frm.Diagram.View.Update():
Help appreciated.
Jimski
ADAdministrator Syncfusion Team September 17, 2004 04:31 PM UTC
Hi Jimski
You should use the Symbol''s Remove() or RemoveAt() Method to remove the labels from the symbol.
Here is a code snippet which demonstrates how you can remove labels of a custom symbol: MySymbol(s) in a Diagram:
//Remove Lables in MySymbol
foreach (MySymbol sym in this.diagram1.Model.Nodes)
{
for (int i=sym.Labels.Count-1; i>=0; i--)
{
sym.Labels.RemoveAt(i);
}
}
this.diagram1.Refresh();
}
Regards
Arun