MS 2.4.9.9 Form Position visible area
This commit is contained in:
parent
a99258cfea
commit
911c7f04ce
@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
|
|||||||
' übernehmen, indem Sie "*" eingeben:
|
' übernehmen, indem Sie "*" eingeben:
|
||||||
' <Assembly: AssemblyVersion("1.0.*")>
|
' <Assembly: AssemblyVersion("1.0.*")>
|
||||||
|
|
||||||
<Assembly: AssemblyVersion("2.4.9.8")>
|
<Assembly: AssemblyVersion("2.4.9.9")>
|
||||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||||
<Assembly: NeutralResourcesLanguage("")>
|
<Assembly: NeutralResourcesLanguage("")>
|
||||||
|
|||||||
@ -413,9 +413,21 @@ Public Class frmMain
|
|||||||
Timer_Inactivity_Reset_Disable("FormLoad")
|
Timer_Inactivity_Reset_Disable("FormLoad")
|
||||||
|
|
||||||
'Restore_Form_Position()
|
'Restore_Form_Position()
|
||||||
ScreenEx.RestoreFormPosition(Me, My.Settings.frmMainPosition)
|
Dim oSavedPosition As Point = My.Settings.frmMainPosition
|
||||||
ScreenEx.RestoreFormState(Me, My.Settings.frmMainWindowState)
|
|
||||||
ScreenEx.RestoreFormSize(Me, My.Settings.frmMainSize)
|
' Prüfen, ob die Position sichtbar ist
|
||||||
|
If IsPositionVisible(oSavedPosition) Then
|
||||||
|
' Position ist sichtbar, das Formular wird dort angezeigt
|
||||||
|
ScreenEx.RestoreFormPosition(Me, My.Settings.frmMainPosition)
|
||||||
|
ScreenEx.RestoreFormState(Me, My.Settings.frmMainWindowState)
|
||||||
|
ScreenEx.RestoreFormSize(Me, My.Settings.frmMainSize)
|
||||||
|
Else
|
||||||
|
' Position ist unsichtbar, Standardposition verwenden
|
||||||
|
Me.StartPosition = FormStartPosition.CenterScreen
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If IDB_ACTIVE = False And ERROR_STATE = "" Then
|
If IDB_ACTIVE = False And ERROR_STATE = "" Then
|
||||||
Try
|
Try
|
||||||
@ -481,7 +493,14 @@ Public Class frmMain
|
|||||||
|
|
||||||
FormOpenClose = False
|
FormOpenClose = False
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Function IsPositionVisible(position As Point) As Boolean
|
||||||
|
For Each scr As Screen In Screen.AllScreens
|
||||||
|
If scr.WorkingArea.Contains(position) Then
|
||||||
|
Return True ' Punkt ist sichtbar
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return False ' Punkt ist außerhalb aller sichtbaren Bereiche
|
||||||
|
End Function
|
||||||
Public Class FontSetting
|
Public Class FontSetting
|
||||||
Public Property Title As String
|
Public Property Title As String
|
||||||
Public Property Value As Integer
|
Public Property Value As Integer
|
||||||
|
|||||||
@ -167,7 +167,14 @@ Public Class frmValidator
|
|||||||
|
|
||||||
Return oOperationMode
|
Return oOperationMode
|
||||||
End Function
|
End Function
|
||||||
|
Private Function IsPositionVisible(position As Point) As Boolean
|
||||||
|
For Each scr As Screen In Screen.AllScreens
|
||||||
|
If scr.WorkingArea.Contains(position) Then
|
||||||
|
Return True ' Punkt ist sichtbar
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Return False ' Punkt ist außerhalb aller sichtbaren Bereiche
|
||||||
|
End Function
|
||||||
Private Sub frmValidation_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
Private Sub frmValidation_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||||
Try
|
Try
|
||||||
|
|
||||||
@ -200,15 +207,30 @@ Public Class frmValidator
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
If My.Settings.frmValidatorPosition.IsEmpty = False Then
|
If My.Settings.frmValidatorPosition.IsEmpty = False Then
|
||||||
If My.Settings.frmValidatorPosition.X > 0 And My.Settings.frmValidatorPosition.Y > 0 Then
|
|
||||||
Location = My.Settings.frmValidatorPosition
|
|
||||||
Else
|
|
||||||
Try
|
|
||||||
Logger.Debug($"!! Invalid PositionData X({My.Settings.frmValidatorPosition.X}), Y({My.Settings.frmValidatorPosition.Y})")
|
|
||||||
Catch ex As Exception
|
|
||||||
|
|
||||||
|
If IsPositionVisible(My.Settings.frmValidatorPosition) Then
|
||||||
|
' Position ist sichtbar, das Formular wird dort angezeigt
|
||||||
|
Try
|
||||||
|
ScreenEx.RestoreFormPosition(Me, My.Settings.frmValidatorPosition)
|
||||||
|
Catch ex As Exception
|
||||||
|
Me.StartPosition = FormStartPosition.CenterScreen
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
|
If My.Settings.frmValidatorPosition.X > 0 And My.Settings.frmValidatorPosition.Y > 0 Then
|
||||||
|
Location = My.Settings.frmValidatorPosition
|
||||||
|
Else
|
||||||
|
Try
|
||||||
|
Logger.Debug($"!! Invalid PositionData X({My.Settings.frmValidatorPosition.X}), Y({My.Settings.frmValidatorPosition.Y})")
|
||||||
|
Catch ex As Exception
|
||||||
|
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
Else
|
||||||
|
' Position ist unsichtbar, Standardposition verwenden
|
||||||
|
Me.StartPosition = FormStartPosition.CenterScreen
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
If My.Settings.frmValidatorSize.IsEmpty = False Then
|
If My.Settings.frmValidatorSize.IsEmpty = False Then
|
||||||
@ -219,8 +241,6 @@ Public Class frmValidator
|
|||||||
Me.WindowState = FormWindowState.Maximized
|
Me.WindowState = FormWindowState.Maximized
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Logger.Info($"Error loading position: {ex.Message}")
|
Logger.Info($"Error loading position: {ex.Message}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user