prevent resizing on moving painting object
This commit is contained in:
@@ -1,10 +1,15 @@
|
||||
Imports System.Drawing
|
||||
Imports System.Runtime.CompilerServices
|
||||
Imports System.Windows.Forms
|
||||
|
||||
Imports Newtonsoft.Json
|
||||
|
||||
Imports Pilz.Drawing
|
||||
|
||||
<Serializable> Friend Class PaintingObjectResizing
|
||||
|
||||
Public Shared Event CheckEnabled(sender As PaintingObjectResizing, ByRef enabled As Boolean)
|
||||
|
||||
Private WithEvents mObj As PaintingObject
|
||||
Private WithEvents mObjParent As Control = Nothing
|
||||
Private WithEvents mObjControl As Control = Nothing
|
||||
@@ -35,13 +40,23 @@ Imports Pilz.Drawing
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public ReadOnly Property PaintingObject As PaintingObject
|
||||
Get
|
||||
Return mObj
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Sub New(obj As PaintingObject)
|
||||
mObj = obj
|
||||
mObjControl = mObj.Parent
|
||||
End Sub
|
||||
|
||||
Shared Function ApplyToControl(obj As PaintingObject) As PaintingObjectResizing
|
||||
Return New PaintingObjectResizing(obj)
|
||||
Private Function IsEnabled() As Boolean
|
||||
Dim enabled = Me.Enabled
|
||||
|
||||
RaiseEvent CheckEnabled(Me, enabled)
|
||||
|
||||
Return enabled
|
||||
End Function
|
||||
|
||||
Private Sub mControl_MouseDown(sender As Object, e As MouseEventArgs) Handles mObj.MouseDown
|
||||
@@ -115,7 +130,7 @@ Imports Pilz.Drawing
|
||||
Dim setToNone As Boolean = False
|
||||
Dim isOnTop As Boolean = mObj.Parent.GetObject(New PointF(realX, realY), True) Is mObj
|
||||
|
||||
If Enabled AndAlso isOnTop Then
|
||||
If IsEnabled() AndAlso isOnTop Then
|
||||
Select Case True
|
||||
Case HelpfulDrawingFunctions.IsPointInRectangle(eLocation, New Rectangle(newRect.X, newRect.Y, newRect.Width, newRect.Height))
|
||||
mObj.Cursor = Cursors.SizeNWSE
|
||||
|
||||
Reference in New Issue
Block a user