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.

Clearing of labels from a symbol

Thread ID:





19095 Sep 17,2004 06:41 AM Sep 17,2004 12:31 PM Windows Forms 1
Tags: Diagram
James Brock
Asked On September 17, 2004 06:41 AM

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

Administrator [Syncfusion]
Replied On September 17, 2004 12:31 PM

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


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.