MS24112015
This commit is contained in:
@@ -2,10 +2,9 @@
|
||||
Imports System.IO
|
||||
|
||||
Public Class ClassWindowLocation
|
||||
|
||||
Public Shared Sub LoadFormLocationSize(ByRef form As Form)
|
||||
Try
|
||||
Dim _path As String
|
||||
Dim _path As String
|
||||
_path = Path.Combine(Application.UserAppDataPath(), "FORM" & form.Name & "-PositionSize.xml")
|
||||
|
||||
Dim layout As ClassLayout = New ClassLayout(_path)
|
||||
@@ -19,10 +18,9 @@ Public Class ClassWindowLocation
|
||||
settings.Add(New ClassSetting("Height", form.Size.Height))
|
||||
layout.Save(settings)
|
||||
End If
|
||||
|
||||
Dim x, y, w, h As Integer
|
||||
For Each s As ClassSetting In settings
|
||||
Dim x, y, w, h As Integer
|
||||
|
||||
'MsgBox(s._name & vbNewLine & s._value)
|
||||
Select Case s._name
|
||||
Case "PositionX"
|
||||
x = Integer.Parse(s._value)
|
||||
@@ -33,23 +31,25 @@ Public Class ClassWindowLocation
|
||||
Case "Height"
|
||||
h = Integer.Parse(s._value)
|
||||
End Select
|
||||
|
||||
If x = 5000 Then
|
||||
form.WindowState = FormWindowState.Maximized
|
||||
Else
|
||||
If x > 0 Then
|
||||
form.Location = New Point(x, y)
|
||||
End If
|
||||
Next
|
||||
If x = 5000 Then
|
||||
form.WindowState = FormWindowState.Maximized
|
||||
Else
|
||||
If x > 0 And y > 0 Then
|
||||
form.Location = New Point(x, y)
|
||||
End If
|
||||
If w > 0 And h > 0 Then
|
||||
form.Size = New Size(w, h)
|
||||
End If
|
||||
|
||||
Next
|
||||
End If
|
||||
Catch notFoundEx As System.IO.FileNotFoundException
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox("Error while loading Window Position!" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Public Shared Sub SaveFormLocationSize(ByRef form As Form)
|
||||
Try
|
||||
|
||||
Reference in New Issue
Block a user