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. Image for the cookie policy date

Programmaticaly accessing custom properties

Hi I am currently evaluating Essential Diagram and it is looking promising for my purposes. 1) I have a custom symbol class: Public Class QuestionSymbol Inherits Syncfusion.Windows.Forms.Diagram.Symbol Private line1 As Line Private line2 As Line Public Sub New() line1 = New Line(New PointF(10, 10), New PointF(10, 20)) Me.AppendChild(line1) line2 = New Line(New PointF(10, 10), New PointF(10, 20)) line2.LineStyle.LineColor = Color.Red line2.LineStyle.LineWidth = 5 Me.AppendChild(line2) End Sub End Class When using SetPropertyCmd I can alter width and color of line1 but not for line2. I have noticed the “Dynamic Symbol” example but this doesn’t use SetPropertyCmd and will therefore not work with Undo/Redo. How do I alter the properties of line2 using SetPropertyCmd? Thanks for any comments

3 Replies

MF Meera Fathima Syncfusion Team October 25, 2005 07:42 AM UTC

Hello Stroyberg, You need to create an instance of your QuestionSymbol class and apply the SetPropertyCmd properties on this instance. This will let you reflect the changes in all the child nodes of the QuestionSymbol class. Here is sample code snippet for your reference. MyQuestionSymbol symbol = new MyQuestionSymbol(); SetPropertyCmd scmd = new SetPropertyCmd(); scmd.Nodes.Add(symbol); scmd.PropertyName = "LineWidth"; scmd.PropertyValue = 5.0F; this.diagram1.Controller.ExecuteCommand(scmd); scmd.Nodes.Clear(); scmd.Nodes.Add(symbol); scmd.PropertyName = "LineColor"; scmd.PropertyValue = Color.Red; this.diagram1.Controller.ExecuteCommand(scmd); Please let me know if you have any further questions on this issue. Thanks and Regards, Meera.


TS Torben Stroyberg October 25, 2005 10:53 AM UTC

Thank you for your quick response to my question. In your example I think you will find that only line1 will be altered with regards to width and color. For line2 things stay unchanged. What I would like to be able to do is to control width and color of each bit that makes up a symbol individually using SetPropertyCmd (ie. width and height of both line1 and line2).


MF Meera Fathima Syncfusion Team October 25, 2005 01:25 PM UTC

Hi Stroyberg, The way to do this would be using the Symbol.GetChildByName() method. This will let you to access and to control each child node of a symbol. Kindly take a look at the attached sample which will give you an idea about what you are seeking. Please let me know if you have any further queries on this issue. Thanks and Regards, Meera.

SetPropertyCmd_line.zip

Loader.
Live Chat Icon For mobile
Up arrow icon