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.
Syncfusion Feedback

Clearing of labels from a symbol

Thread ID:

Created:

Updated:

Platform:

Replies:

19095 Sep 17,2004 10:41 AM UTC Sep 17,2004 04:31 PM UTC WinForms 1
loading
Tags: Diagram
James Brock
Asked On September 17, 2004 10:41 AM UTC

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 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

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.

Warning Icon 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.Close Icon

;