Group: Forum Members
Last Active: Last Week
Posts: 3,054,
Visits: 4,009
|
Hi, All custom classes you want to take part in the serialization process should be marked as Serializable. If you do not want to serialize any of the class fields simply mark it as NonSerialized.
Best Regards, Nevron Support Team
|
Group: Forum Members
Last Active: 11 Years Ago
Posts: 6,
Visits: 1
|
I implemented a custom port but the saving and loading of the diagram does not work. How do I save a drawing with custom classes? Private Sub butSave_Click(sender As Object, e As EventArgs) Handles butSave.Click Dim pm As New NPersistencyManagerpm.SaveDocumentToFile(document, "c:\\temp\\drawing1.nds")End Sub Private Sub butLoad_Click(sender As Object, e As EventArgs) Handles butLoad.Click Dim pm As New NPersistencyManagerdocument = pm.LoadDocumentFromFile( "c:\\temp\\drawing1.nds")view.Document = document End Sub Public Class DLogicalLinePort Inherits NLogicalLinePortPublic Overrides Sub Paint(ByVal context As NPaintContext)' Compute the bounds of the port in device coordinatesDim location__1 As NPointF = context.SceneToDevice.TransformPoint(Location)Dim width As Single = NDR.BitmapPortSize.WidthDim height As Single = NDR.BitmapPortSize.HeightDim bounds As New NRectangleF(location__1.X - width / 2, location__1.Y - height / 2, width, height)' Clip testIf context.DevicePaintArea.IntersectsWith(bounds) = False ThenReturnEnd If' Paint the portDim circle As New NEllipsePath(bounds.Location, bounds.RightBottom)NStyle.SetFillStyle(circle, New NColorFillStyle(Color.FromArgb(125, Color.Yellow)))NStyle.SetStrokeStyle(circle, New NStrokeStyle(KnownArgbColorValue.Red))circle.Paint(context) End SubEnd Class
|