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.

MySymbol

Thread ID:

Created:

Updated:

Platform:

Replies:

59213 Apr 6,2007 09:26 AM Apr 10,2007 03:06 AM ASP.NET Web Forms (Classic) 2
loading
Tags: DiagramWebControl
Foucault Dupleix
Asked On April 6, 2007 09:26 AM

I have been trying to create my own Symbol, using your example :
ms-help://MS.VSCC.v80/Syncfusion/SfDiagramBase/Symbols1.html

But when I try to use it, an unknown exception is handle :

" Server Error in '/solution' Application.
--------------------------------------------------------------------------------

Type 'MySymbol' in Assembly 'App_Web_kwx1gkv4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.Serialization.SerializationException: Type 'MySymbol' in Assembly 'App_Web_kwx1gkv4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

<%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:







Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario."


This is the code I use:
Dim insCmd_Poly As InsertNodesCmd = New InsertNodesCmd()
Dim poly1 As MySymbol = New MySymbol()
insCmd_Poly.AddNode(poly1, New PointF(50, 30))
insCmd_Poly.Do(Me.DiagramWebControl1.Model)

Do I forget something?


J.Nagarajan [Syncfusion]
Replied On April 7, 2007 12:33 PM

Hi Dupleix,

Thanks for using Syncfusion product.

You have to add Serialization constructor and Serialization state information to your custom symbol. Please add the following codes in your custom symbol to resolve your problem

[Serializable()]
public class MySymbol : Symbol
{
public MySymbol()
{
//Add your custom symbol code here
}
// Serialization constructor for symbols.
protected override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
}
// Called when deserialization is complete.
protected override void OnDeserialization(object sender)
{
base.OnDeserialization(sender);

// Get references to the child objects
this.outerRect = this.GetChildByName("Rectangle") as Syncfusion.Windows.Forms.Diagram.Rectangle;
this.innerEllipse = this.GetChildByName("Ellipse") as Ellipse;
}

I have attached my Custom Symbol file for your reference. Please refer to this MySymbol Class and Serialization constructor for symbols.

Also refer to our ScriptyClient sample (C:\Program Files\Syncfusion\Essential Studio\4.4.0.51\Web\diagram.web\Samples\2.0\ScriptyClient) for more details. In this sample when yiu click on the "Add Symbol" button, you can add a button to the DiagramWebControl.

I hope this will resolve your problem. Let me know if you have any questions.

Thanks,
Nagaraj
CustomSymbol.zip


Foucault Dupleix
Replied On April 10, 2007 03:06 AM

It worked, thanks a lot

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.

;