Base: add RetoreWindowSize

This commit is contained in:
Jonathan Jenne 2023-06-16 10:32:50 +02:00
parent e156cc9d88
commit f2e275c8bd

View File

@ -3,6 +3,9 @@ Imports System.Drawing
Imports System.Windows.Forms
Public Class ScreenEx
Public Const DEFAULT_WINDOW_HEIGHT = 480
Public Const DEFAULT_WINDOW_WIDTH = 640
Public Shared Function GetLocationWithinScreen(pLocation As Point) As Point?
For Each screen As Screen In Screen.AllScreens
If screen.Bounds.Contains(pLocation) Then
@ -46,6 +49,17 @@ Public Class ScreenEx
RestoreFormState(pForm, oFormState)
End Sub
Public Shared Sub RetoreWindowSize(pForm As Form, pFormSize As Size)
Dim oFormSize As Size
If pFormSize.Height < 1 Or pFormSize.Width < 1 Or pFormSize.IsEmpty Then
oFormSize = New Size(DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT)
Else
oFormSize = pFormSize
End If
pForm.Size = oFormSize
End Sub
''' <summary>
''' Checks if a point is Visible on any screen
''' </summary>