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.

Dynamically Change the Custom Symbols Colour

Thread ID:

Created:

Updated:

Platform:

Replies:

39043 Dec 23,2005 05:31 AM Dec 27,2005 05:15 PM Windows Forms 4
loading
Tags: Diagram
David Llewellyn
Asked On December 23, 2005 05:31 AM

Hello, I read that a a custom symbols colour could be changed dynamically. This would be ideal for me, as I would like to colour my symbol depending on its state. I read this in a previous message in this forum: "if you want to change a non-default value for one of the symbol''''s child nodes, then you will have to do this by directly the child node and applying the new property value directly to it". How do I change the colour of say the inner ellipse in Syncfusions custom symbols example? I would be grateful if somebody could post some code describing how this can be achieved. Thank you. David

Administrator [Syncfusion]
Replied On December 23, 2005 01:14 PM

David, If your custom symbol is a programmatically defined type then you should be able to directly change the inner node''s color from within your symbol class defintion. This approach is demonstrated in the DynamicSymbol sample that ships with the product. For symbols defined with the SymbolDesigner, you will have to provide an easily identifiable name for the symbol''s child nodes (through the Node.Name property), and then use the Symbol class methods to retrieve the child node. The Symbol.GetChildByName(string) method will help you with this. Once you have the child node you can set the Node''s FillStyle property to change the forecolor, backcolor etc. Prakash Surendra Syncfusion Inc.,

David Llewellyn
Replied On December 23, 2005 05:54 PM

Hello Prakash, Thank you for the information. I''m still unsure how to change the FillStyle property of an INode object. I have created a symbol using the SymbolDesigner and can retrieve the Node that I wish to change colour. For example I have done this: Symbol selectedSymbol = node as Symbol; INode tmpNode = selectedSymbol.GetChildByName("TestNode"); But how do access "tmpNode"''s FillStyle property. The fillstyle property does not exist in the INode class. The tmpNode only has the following properties: FullName, Name, Parent, Root. Thanks, David. >David, > >If your custom symbol is a programmatically defined type then you should be able to directly change the inner node''s color from within your symbol class defintion. This approach is demonstrated in the DynamicSymbol sample that ships with the product. > >For symbols defined with the SymbolDesigner, you will have to provide an easily identifiable name for the symbol''s child nodes (through the Node.Name property), and then use the Symbol class methods to retrieve the child node. The Symbol.GetChildByName(string) method will help you with this. Once you have the child node you can set the Node''s FillStyle property to change the forecolor, backcolor etc. > >Prakash Surendra >Syncfusion Inc.,

David Llewellyn
Replied On December 23, 2005 07:59 PM

Hello again, I have also tried to change the colour of all the nodes, just as a test by doing the following: foreach (INode node in this.diagram1.Model.Nodes) { Symbol selectedSymbol = node as Symbol; if (selectedSymbol != null) { selectedSymbol.FillStyle.GradientStartColor = Color.RoyalBlue; selectedSymbol.FillStyle.Color = Color.RoyalBlue; } } This doesn''t change the colour of any of the symbols I have added to my diagram (I only have one custom Symbols, which I wish to colour differently). Can somebody tell me what I am doing wrong here? Thank you and regards. David

Administrator [Syncfusion]
Replied On December 27, 2005 05:15 PM

David, It is possible that you have set a non-default value for the symbol''s child nodes. Please refer to this forum post for an explanation of how child node property values affect the propagation of symbol properties - http://www.syncfusion.com/Support/forums/message.aspx?MessageID=38140. I hope this helps. If not please let me know. Prakash Surendra Syncfusion Inc.,

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.

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.

;