This commit is contained in:
2021-02-11 14:35:25 +01:00
3 changed files with 28 additions and 2 deletions

View File

@@ -19,18 +19,22 @@ Imports Newtonsoft.Json
Public Property OutlineColor As Color = Color.DarkBlue Public Property OutlineColor As Color = Color.DarkBlue
Public Property OutlineThicknes As Single = 1 Public Property OutlineThicknes As Single = 1
Public Property OutlineDashStyle As DashStyle = DashStyle.Solid Public Property OutlineDashStyle As DashStyle = DashStyle.Solid
<JsonProperty>
Private _Text As String = "" Private _Text As String = ""
Public Property TextPosition As TextPosition = TextPosition.FullCenter Public Property TextPosition As TextPosition = TextPosition.FullCenter
Public Property VerticalTextAlignment As StringAlignment = StringAlignment.Center Public Property VerticalTextAlignment As StringAlignment = StringAlignment.Center
Public Property HorizontalTextAlignment As StringAlignment = StringAlignment.Center Public Property HorizontalTextAlignment As StringAlignment = StringAlignment.Center
Public Property TextFont As New Font(FontFamily.GenericSansSerif, 8.25) Public Property TextFont As New Font(FontFamily.GenericSansSerif, 8.25)
Public Property TextColor As Color = Color.Black Public Property TextColor As Color = Color.Black
<JsonProperty>
Private _Location As New PointF(50, 50) Private _Location As New PointF(50, 50)
<JsonProperty>
Private _Size As New SizeF(50, 80) Private _Size As New SizeF(50, 80)
Public Property EnableFill As Boolean = True Public Property EnableFill As Boolean = True
Public Property EnableOutline As Boolean = True Public Property EnableOutline As Boolean = True
Public Property SelectionColor As Color = Color.CornflowerBlue Public Property SelectionColor As Color = Color.CornflowerBlue
Public Property SelectionDashStyle As DashStyle = DashStyle.Dot Public Property SelectionDashStyle As DashStyle = DashStyle.Dot
<JsonProperty>
Private _EnableSelection As Boolean = True Private _EnableSelection As Boolean = True
Public Property Image As Image = Nothing Public Property Image As Image = Nothing
<JsonIgnore> Public Property BufferedImage As Image = Nothing <JsonIgnore> Public Property BufferedImage As Image = Nothing
@@ -39,15 +43,20 @@ Imports Newtonsoft.Json
Public Property Tag As String = Nothing Public Property Tag As String = Nothing
Public Property Name As String = "" Public Property Name As String = ""
Public ReadOnly Property PinnedObjects As New List(Of PaintingObject) Public ReadOnly Property PinnedObjects As New List(Of PaintingObject)
<JsonIgnore>
Public ReadOnly Property DrawMethodes As New List(Of DelegateDrawPaintingObjectMethode) Public ReadOnly Property DrawMethodes As New List(Of DelegateDrawPaintingObjectMethode)
<JsonIgnore>
Public ReadOnly Property DrawSelectionMethode As DelegateDrawPaintingObjectMethode = AddressOf DefaultDrawMethodes.DrawSelection Public ReadOnly Property DrawSelectionMethode As DelegateDrawPaintingObjectMethode = AddressOf DefaultDrawMethodes.DrawSelection
Public Property Cursor As Cursor = Cursors.Default Public Property Cursor As Cursor = Cursors.Default
Public Property HardcodedSize As Boolean = False Public Property HardcodedSize As Boolean = False
<JsonProperty>
Private _Visible As Boolean = True Private _Visible As Boolean = True
<JsonProperty>
Private _AutoAlignToGrid As Boolean = False Private _AutoAlignToGrid As Boolean = False
Public Property MouseTransparency As Boolean = False Public Property MouseTransparency As Boolean = False
Public ReadOnly Property Layering As New PaintingObjectLayering(Me) Public ReadOnly Property Layering As New PaintingObjectLayering(Me)
Public ReadOnly Property PaintingObjects As New PaintingObjectList(_Parent) With {.EnableRaisingEvents = False} Public ReadOnly Property PaintingObjects As New PaintingObjectList(_Parent) With {.EnableRaisingEvents = False}
<JsonIgnore>
Public ReadOnly Property ErrorsAtDrawing As ULong = 0 Public ReadOnly Property ErrorsAtDrawing As ULong = 0
Public Event MouseClick(sender As PaintingObject, e As MouseEventArgs) Public Event MouseClick(sender As PaintingObject, e As MouseEventArgs)
@@ -321,6 +330,7 @@ Imports Newtonsoft.Json
End Set End Set
End Property End Property
<JsonIgnore>
Public Property Rectangle As RectangleF Public Property Rectangle As RectangleF
Get Get
Return New RectangleF(Location, Size) Return New RectangleF(Location, Size)
@@ -528,8 +538,10 @@ End Class
Public Class PaintingObjectList Public Class PaintingObjectList
Inherits List(Of PaintingObject) Inherits List(Of PaintingObject)
<JsonIgnore>
Friend ReadOnly Property MyParent As PaintingControl Friend ReadOnly Property MyParent As PaintingControl
Friend Property EnableRaisingEvents As Boolean = True Friend Property EnableRaisingEvents As Boolean = True
<JsonIgnore>
Public ReadOnly Property Layering As New PaintingObjectListLayering(Me) Public ReadOnly Property Layering As New PaintingObjectListLayering(Me)
Public Sub New() Public Sub New()

View File

@@ -0,0 +1,3 @@
Public Class PaintingObjectJsonSerializer
End Class

View File

@@ -1,11 +1,22 @@
Public Class PaintingObjectLayering Imports Newtonsoft.Json
Public Class PaintingObjectLayering
<JsonProperty(NameOf(PaintingObject))>
Private ReadOnly _PaintingObject As PaintingObject
<JsonIgnore>
Public ReadOnly Property PaintingObject As PaintingObject Public ReadOnly Property PaintingObject As PaintingObject
Get
Return _PaintingObject
End Get
End Property
''' <summary> ''' <summary>
''' Get the current object list from the painting object. ''' Get the current object list from the painting object.
''' </summary> ''' </summary>
''' <returns>Returns the current object list from the painting object.</returns> ''' <returns>Returns the current object list from the painting object.</returns>
<JsonIgnore>
Public ReadOnly Property ObjectList As PaintingObjectList Public ReadOnly Property ObjectList As PaintingObjectList
Get Get
Return PaintingObject.Parent.PaintingObjects Return PaintingObject.Parent.PaintingObjects
@@ -17,7 +28,7 @@
''' </summary> ''' </summary>
''' <param name="obj"></param> ''' <param name="obj"></param>
Public Sub New(obj As PaintingObject) Public Sub New(obj As PaintingObject)
PaintingObject = obj _PaintingObject = obj
End Sub End Sub
''' <summary> ''' <summary>