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.Runtime.CompilerServices
|
||||
Imports System.Windows.Forms
|
||||
@@ -348,9 +349,14 @@ Public Class PaintingControl
|
||||
End Sub
|
||||
|
||||
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,
|
||||
e.Y - sp.Y + Offset.Y)
|
||||
obj.RaiseMoving(New EventArgs)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
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.Reflection
|
||||
Imports System.Runtime.CompilerServices
|
||||
@@ -59,6 +60,7 @@ Imports Newtonsoft.Json
|
||||
Public Event VisibleChanged(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 MovingBeforePositionUpdated(sender As PaintingObject, e As CancelEventArgs)
|
||||
|
||||
Public Sub New()
|
||||
End Sub
|
||||
@@ -93,6 +95,9 @@ Imports Newtonsoft.Json
|
||||
Friend Sub RaiseMoving(e As EventArgs)
|
||||
RaiseEvent Moving(Me, e)
|
||||
End Sub
|
||||
Friend Sub RaiseMovingBeforePositionUpdated(e As EventArgs)
|
||||
RaiseEvent MovingBeforePositionUpdated(Me, e)
|
||||
End Sub
|
||||
|
||||
Public Property Type As PaintingObjectType
|
||||
Get
|
||||
@@ -493,7 +498,7 @@ Imports Newtonsoft.Json
|
||||
End Sub
|
||||
|
||||
copyFields(Me, obj, blackField, metype)
|
||||
copyfields(ImageProperties, obj.ImageProperties, {}, ImageProperties.GetType)
|
||||
copyFields(ImageProperties, obj.ImageProperties, {}, ImageProperties.GetType)
|
||||
|
||||
If includePinnedObject Then
|
||||
obj.PinnedObjects.AddRange(PinnedObjects)
|
||||
@@ -536,7 +541,7 @@ Public Class PaintingObjectList
|
||||
End Sub
|
||||
|
||||
Public Overloads Sub Add(item As PaintingObject)
|
||||
item.Parent = myParent
|
||||
item.Parent = MyParent
|
||||
MyBase.Add(item)
|
||||
item.AutoArrangeToGrid()
|
||||
If EnableRaisingEvents Then
|
||||
@@ -546,7 +551,7 @@ Public Class PaintingObjectList
|
||||
|
||||
Public Overloads Sub AddRange(items As PaintingObject())
|
||||
For Each item As PaintingObject In items
|
||||
item.Parent = myParent
|
||||
item.Parent = MyParent
|
||||
Next
|
||||
MyBase.AddRange(items)
|
||||
For Each item As PaintingObject In items
|
||||
@@ -558,9 +563,9 @@ Public Class PaintingObjectList
|
||||
End Sub
|
||||
|
||||
Public Overloads Sub Insert(index As Integer, item As PaintingObject)
|
||||
item.Parent = myParent
|
||||
item.Parent = MyParent
|
||||
MyBase.Insert(index, item)
|
||||
myParent?.AutoArrangeToGrid()
|
||||
MyParent?.AutoArrangeToGrid()
|
||||
If EnableRaisingEvents Then
|
||||
MyParent?.RaisePaintingObjectAdded(New PaintingObjectEventArgs({item}))
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user