Unterstützung für MSG/EML-Dateien hinzugefügt
Aktualisierung der `App.config` mit neuen `bindingRedirect`-Versionen und Hinzufügen von Abhängigkeiten wie `OpenMcdf` und `Microsoft.Bcl.AsyncInterfaces`. Erweiterung von `DocumentViewer.vb` zur Unterstützung von `.MSG`- und `.EML`-Dateien, inklusive Konvertierung von `.MSG` zu HTML. Verbesserte Fehlerbehandlung und Logging. Einführung der Eigenschaft `SnappingEnabled` in `SnapPanel.vb` und Optimierung des Rasters. Erweiterte Validierung und Logging in `frmDocumentResultList.vb`. Aktualisierung der Projektdateien mit neuen Paketverweisen und Abhängigkeitsversionen. Anpassung der Assembly-Versionen in `AssemblyInfo.vb`.
This commit is contained in:
@@ -8,12 +8,22 @@ Public Class ClassSnapPanel
|
||||
Private _ShowGrid As Boolean = True
|
||||
Private _GridSize As Integer = 16
|
||||
Private _NeedsScrollUpdate As Boolean = False
|
||||
|
||||
Private _SnappingEnabled As Boolean = True ' ← Neu: Snapping deaktivierbar
|
||||
Public Sub New()
|
||||
Me.AutoScroll = True
|
||||
Me.DoubleBuffered = True ' Flackern reduzieren
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Deaktiviert das Snapping temporär (z.B. beim Laden von Controls aus der DB)
|
||||
''' </summary>
|
||||
Public Property SnappingEnabled As Boolean
|
||||
Get
|
||||
Return _SnappingEnabled
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
_SnappingEnabled = value
|
||||
End Set
|
||||
End Property
|
||||
Public Property GridSize As Integer
|
||||
Get
|
||||
Return _GridSize
|
||||
@@ -40,15 +50,11 @@ Public Class ClassSnapPanel
|
||||
|
||||
Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
|
||||
MyBase.OnControlAdded(e)
|
||||
AddHandler e.Control.LocationChanged, AddressOf AlignToGrid
|
||||
AddHandler e.Control.MouseUp, AddressOf AlignToGrid
|
||||
ScheduleScrollUpdate()
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnControlRemoved(e As ControlEventArgs)
|
||||
MyBase.OnControlRemoved(e)
|
||||
RemoveHandler e.Control.LocationChanged, AddressOf AlignToGrid
|
||||
RemoveHandler e.Control.MouseUp, AddressOf AlignToGrid
|
||||
ScheduleScrollUpdate()
|
||||
End Sub
|
||||
|
||||
@@ -56,19 +62,38 @@ Public Class ClassSnapPanel
|
||||
MyBase.OnLayout(levent)
|
||||
ScheduleScrollUpdate()
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Snappt ein Control manuell auf das Grid - wird von frmFormDesigner nach einem echten Drag aufgerufen
|
||||
''' </summary>
|
||||
Public Sub SnapControlToGrid(ctrl As Control)
|
||||
If Not _SnappingEnabled OrElse Not _ShowGrid OrElse Me.DesignMode Then Return
|
||||
Dim x As Integer = Math.Floor(ctrl.Left / _GridSize) * _GridSize
|
||||
Dim y As Integer = Math.Floor(ctrl.Top / _GridSize) * _GridSize
|
||||
ctrl.Location = New Point(x, y)
|
||||
ScheduleScrollUpdate()
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnPaint(e As PaintEventArgs)
|
||||
MyBase.OnPaint(e)
|
||||
|
||||
If Not Me.DesignMode AndAlso _ShowGrid Then
|
||||
Dim scrollOffset As Point = Me.AutoScrollPosition
|
||||
Dim gridRect As New Rectangle(-scrollOffset.X, -scrollOffset.Y, Me.ClientSize.Width, Me.ClientSize.Height)
|
||||
Dim scroll As Point = Me.AutoScrollPosition
|
||||
' Grid-Ursprung am virtuellen Canvas (0,0) ausrichten
|
||||
' AutoScrollPosition ist negativ → Modulo ergibt positiven Offset im sichtbaren Bereich
|
||||
Dim offsetX As Integer = ((scroll.X Mod _GridSize) + _GridSize) Mod _GridSize
|
||||
Dim offsetY As Integer = ((scroll.Y Mod _GridSize) + _GridSize) Mod _GridSize
|
||||
' Rechteck um je eine Rasterzelle vergrößern damit keine Lücken entstehen
|
||||
Dim gridRect As New Rectangle(
|
||||
offsetX - _GridSize,
|
||||
offsetY - _GridSize,
|
||||
Me.ClientSize.Width + _GridSize * 2,
|
||||
Me.ClientSize.Height + _GridSize * 2)
|
||||
ControlPaint.DrawGrid(e.Graphics, gridRect, New Size(_GridSize, _GridSize), Me.BackColor)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub AlignToGrid(sender As Object, e As EventArgs)
|
||||
If Not _ShowGrid OrElse Me.DesignMode Then Return
|
||||
' ← Snapping nur wenn aktiv
|
||||
If Not _SnappingEnabled OrElse Not _ShowGrid OrElse Me.DesignMode Then Return
|
||||
|
||||
Dim ctrl As Control = CType(sender, Control)
|
||||
Dim x As Integer = Math.Floor(ctrl.Left / _GridSize) * _GridSize
|
||||
@@ -87,6 +112,11 @@ Public Class ClassSnapPanel
|
||||
End Sub))
|
||||
End If
|
||||
End Sub
|
||||
Protected Overrides Sub OnScroll(se As ScrollEventArgs)
|
||||
MyBase.OnScroll(se)
|
||||
' Nach dem Scrollen vollständig neu zeichnen
|
||||
Invalidate()
|
||||
End Sub
|
||||
|
||||
Private Sub UpdateScrollArea()
|
||||
Dim maxWidth As Integer = 0
|
||||
|
||||
Reference in New Issue
Block a user