new moving event for painting objects
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
Imports System.Drawing
|
Imports System.ComponentModel
|
||||||
|
Imports System.Drawing
|
||||||
Imports System.Drawing.Drawing2D
|
Imports System.Drawing.Drawing2D
|
||||||
Imports System.Runtime.CompilerServices
|
Imports System.Runtime.CompilerServices
|
||||||
Imports System.Windows.Forms
|
Imports System.Windows.Forms
|
||||||
@@ -348,9 +349,14 @@ Public Class PaintingControl
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub UpdateObjectPosition(e As MouseEventArgs, obj As PaintingObject, sp As PointF)
|
Private Sub UpdateObjectPosition(e As MouseEventArgs, obj As PaintingObject, sp As PointF)
|
||||||
|
Dim cancel As New CancelEventArgs(False)
|
||||||
|
obj.RaiseMovingBeforePositionUpdated(cancel)
|
||||||
|
|
||||||
|
If Not cancel.Cancel Then
|
||||||
obj.Location = New Point(e.X - sp.X + Offset.X,
|
obj.Location = New Point(e.X - sp.X + Offset.X,
|
||||||
e.Y - sp.Y + Offset.Y)
|
e.Y - sp.Y + Offset.Y)
|
||||||
obj.RaiseMoving(New EventArgs)
|
obj.RaiseMoving(New EventArgs)
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Function IsResizingObjs(objs As IList(Of PaintingObject)) As Boolean
|
Private Function IsResizingObjs(objs As IList(Of PaintingObject)) As Boolean
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
Imports System.Drawing
|
Imports System.ComponentModel
|
||||||
|
Imports System.Drawing
|
||||||
Imports System.Drawing.Drawing2D
|
Imports System.Drawing.Drawing2D
|
||||||
Imports System.Reflection
|
Imports System.Reflection
|
||||||
Imports System.Runtime.CompilerServices
|
Imports System.Runtime.CompilerServices
|
||||||
@@ -59,6 +60,7 @@ Imports Newtonsoft.Json
|
|||||||
Public Event VisibleChanged(sender As PaintingObject, e As EventArgs)
|
Public Event VisibleChanged(sender As PaintingObject, e As EventArgs)
|
||||||
Public Event Moved(sender As PaintingObject, e As EventArgs)
|
Public Event Moved(sender As PaintingObject, e As EventArgs)
|
||||||
Public Event Moving(sender As PaintingObject, e As EventArgs)
|
Public Event Moving(sender As PaintingObject, e As EventArgs)
|
||||||
|
Public Event MovingBeforePositionUpdated(sender As PaintingObject, e As CancelEventArgs)
|
||||||
|
|
||||||
Public Sub New()
|
Public Sub New()
|
||||||
End Sub
|
End Sub
|
||||||
@@ -93,6 +95,9 @@ Imports Newtonsoft.Json
|
|||||||
Friend Sub RaiseMoving(e As EventArgs)
|
Friend Sub RaiseMoving(e As EventArgs)
|
||||||
RaiseEvent Moving(Me, e)
|
RaiseEvent Moving(Me, e)
|
||||||
End Sub
|
End Sub
|
||||||
|
Friend Sub RaiseMovingBeforePositionUpdated(e As EventArgs)
|
||||||
|
RaiseEvent MovingBeforePositionUpdated(Me, e)
|
||||||
|
End Sub
|
||||||
|
|
||||||
Public Property Type As PaintingObjectType
|
Public Property Type As PaintingObjectType
|
||||||
Get
|
Get
|
||||||
@@ -493,7 +498,7 @@ Imports Newtonsoft.Json
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
copyFields(Me, obj, blackField, metype)
|
copyFields(Me, obj, blackField, metype)
|
||||||
copyfields(ImageProperties, obj.ImageProperties, {}, ImageProperties.GetType)
|
copyFields(ImageProperties, obj.ImageProperties, {}, ImageProperties.GetType)
|
||||||
|
|
||||||
If includePinnedObject Then
|
If includePinnedObject Then
|
||||||
obj.PinnedObjects.AddRange(PinnedObjects)
|
obj.PinnedObjects.AddRange(PinnedObjects)
|
||||||
@@ -536,7 +541,7 @@ Public Class PaintingObjectList
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overloads Sub Add(item As PaintingObject)
|
Public Overloads Sub Add(item As PaintingObject)
|
||||||
item.Parent = myParent
|
item.Parent = MyParent
|
||||||
MyBase.Add(item)
|
MyBase.Add(item)
|
||||||
item.AutoArrangeToGrid()
|
item.AutoArrangeToGrid()
|
||||||
If EnableRaisingEvents Then
|
If EnableRaisingEvents Then
|
||||||
@@ -546,7 +551,7 @@ Public Class PaintingObjectList
|
|||||||
|
|
||||||
Public Overloads Sub AddRange(items As PaintingObject())
|
Public Overloads Sub AddRange(items As PaintingObject())
|
||||||
For Each item As PaintingObject In items
|
For Each item As PaintingObject In items
|
||||||
item.Parent = myParent
|
item.Parent = MyParent
|
||||||
Next
|
Next
|
||||||
MyBase.AddRange(items)
|
MyBase.AddRange(items)
|
||||||
For Each item As PaintingObject In items
|
For Each item As PaintingObject In items
|
||||||
@@ -558,9 +563,9 @@ Public Class PaintingObjectList
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Overloads Sub Insert(index As Integer, item As PaintingObject)
|
Public Overloads Sub Insert(index As Integer, item As PaintingObject)
|
||||||
item.Parent = myParent
|
item.Parent = MyParent
|
||||||
MyBase.Insert(index, item)
|
MyBase.Insert(index, item)
|
||||||
myParent?.AutoArrangeToGrid()
|
MyParent?.AutoArrangeToGrid()
|
||||||
If EnableRaisingEvents Then
|
If EnableRaisingEvents Then
|
||||||
MyParent?.RaisePaintingObjectAdded(New PaintingObjectEventArgs({item}))
|
MyParent?.RaisePaintingObjectAdded(New PaintingObjectEventArgs({item}))
|
||||||
End If
|
End If
|
||||||
|
|||||||
Reference in New Issue
Block a user