I have a form that has the following code onload.
Expand|Select|Wrap|Line Numbers
- If Not My.Settings.MyLocation.IsEmpty Then
- Me.Location = My.Settings.MyLocation
- End If
- If Not My.Settings.MySize.IsEmpty Then
- Me.Size = My.Settings.MySize
- End If
- Me.WindowState = FormWindowState.Normal
Expand|Select|Wrap|Line Numbers
- If Me.WindowState = FormWindowState.Normal Then
- My.Settings.MySize = Me.Size
- My.Settings.MyLocation = Me.Location
- My.Settings.Save()
- End If
However if the form was closed by right-clicking whilst it was minimised, it seems to ignore these settings and the requested Normal window state and remains minimised when loaded without any way to reinstate it.
This only seems to occur when the form is opened, minimised, closed whilst minimised then opened again. (Opening is done via a Show() command). The first loading seems to be ok.
Any ideas what on earth is going on and/or how to force the form to open at the stored size/location and normal state every time, no matter what state it was in when closed?
Thanks