jj: Prevent moving control out of panel
This commit is contained in:
parent
6755ce60ea
commit
41bd11d924
@ -571,12 +571,32 @@
|
|||||||
Mouse_Down = False
|
Mouse_Down = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub Control_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
|
Private Sub Control_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseUp
|
||||||
' The button was released, so we're going back to Static mode.
|
' The button was released, so we're going back to Static mode.
|
||||||
If Mouse_Moving = True Then
|
If Mouse_Moving = True Then
|
||||||
Mouse_Moving = False
|
Mouse_Moving = False
|
||||||
'end_location = e.Location
|
'end_location = e.Location
|
||||||
DesignerCtrlBuilder.EndLocation = e.Location
|
DesignerCtrlBuilder.EndLocation = e.Location
|
||||||
|
Dim currentPosition As Point = DesignerCtrlBuilder.CurrentControl.Location
|
||||||
|
|
||||||
|
' Das Control sollte nicht außerhalb des Panels geschoben werden (Koordinaten kleiner 0)
|
||||||
|
If CurrentPosition.X < 0 Then
|
||||||
|
DesignerCtrlBuilder.CurrentControl.Location = New Point(0, DesignerCtrlBuilder.CurrentControl.Location.Y)
|
||||||
|
End If
|
||||||
|
|
||||||
|
If CurrentPosition.Y < 0 Then
|
||||||
|
DesignerCtrlBuilder.CurrentControl.Location = New Point(DesignerCtrlBuilder.CurrentControl.Location.X, 0)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Ebenso nicht über die Größe des Panels (X-Achse)
|
||||||
|
If CurrentPosition.X > pnlDesigner.Width Then
|
||||||
|
DesignerCtrlBuilder.CurrentControl.Location = New Point(pnlDesigner.Width - DesignerCtrlBuilder.CurrentControl.Width, DesignerCtrlBuilder.CurrentControl.Location.Y)
|
||||||
|
End If
|
||||||
|
|
||||||
|
' Ebenso nicht über die Größe des Panels (Y-Achse)
|
||||||
|
If CurrentPosition.Y > pnlDesigner.Height Then
|
||||||
|
DesignerCtrlBuilder.CurrentControl.Location = New Point(DesignerCtrlBuilder.CurrentControl.Location.X, pnlDesigner.Height - DesignerCtrlBuilder.CurrentControl.Height)
|
||||||
|
End If
|
||||||
|
|
||||||
'frmTool_ControlProperties.Instance.UpdateControlLocation(CtrlBuilder.CurrentControl)
|
'frmTool_ControlProperties.Instance.UpdateControlLocation(CtrlBuilder.CurrentControl)
|
||||||
UpdateControlLocation(DesignerCtrlBuilder.CurrentControl)
|
UpdateControlLocation(DesignerCtrlBuilder.CurrentControl)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user