I add two events into your RectangleSymbol. Now you save the symbol and reload it. If you click on it, it will get error saying the this.rect is null. It look like we need to add code to get the this.rect when it is deserializing.
Any idea?
protected override void OnMouseEnter(NodeMouseEventArgs evtArgs)
{
// TODO: Add ConditionSysbol.OnMouseEnter implementation
this.rect.FillStyle.Color = System.Drawing.Color.AntiqueWhite;
}
protected override void OnMouseLeave(NodeMouseEventArgs evtArgs)
{
// TODO: Add ConditionSysbol.OnMouseLeave implementation
this.rect.FillStyle.Color = System.Drawing.Color.AliceBlue;
}
>Hi Jose,
>
>
Here is a sample that does what you are looking for. The main points are:
>
>- There are 2 custom Symbols: Rectangle and Triangle. Take a look MySymbol.cs where the Custom symbols are implemented with ISerializable along with overrides for GetObjectData and OnDeserialization.
>- In the Diagram''s MouseDown the Custom Symbol is selected when right-clicked.
>- In the Diagram''s MouseUp event, menuitems are added to the ContextMenus based on the Symbol which is right clicked. The colors of the Symbol are changed based on the selection in the Context Menu.
>- The Diagram can be saved by clicking on the Save Diagram Button and loaded by clicking on the Load Diagram Method.
>
>Also take a look at the DynamicSymbol sample that demonstrates how custom properties of Symbols can be serialized.
>
>Regards
>Arun