Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

When a form is minimized or maximized the size and location properties change. But where are the normal state's size and location stored in the meantime?

 

Or is some event fired when the user minimizes or maximizes the form?

 

I'm actually trying to save the form state of my main form on program end and restore the size and location on program start.

Posted

This article talks about a RestoreBounds method. I cannot find this within my .Net environment, so I'm going to go ahead and assume its .Net 2.0 exclusive. If your using .Net 2.0 then check out the article. If your not, I would do it as follows.

 

If I remember correctly from your other post your working in VB. So here goes...

' have these two public variables
Public m_Size as Size
Public m_State as FormWindowState
'
' in your resize event
If WindowState = FormWindowState.Normal Then
   ' the form isn't maximised or minimised so store the new size
   m_Size = Size
End If
'
' store the state so you can restore the application minimised
m_state = WindowState

Anybody looking for a graduate programmer (Midlands, England)?
Posted (edited)

I really want to stay away from "My.Settings" and rather save my settings to a simple text file.

 

For know I'll settle for the resize event, but I'm still open for better ways in case someone comes across one.¨

 

PS: You have been very active today Cags. :D Thanks a lot!!

Edited by JumpyNET
  • Leaders
Posted
Note the MaximizedBounds and RestoreBounds properties. These set/return the bounds that the form will assume in the respective state, regardless of the current state.
[sIGPIC]e[/sIGPIC]
Posted
Note the MaximizedBounds and RestoreBounds properties. These set/return the bounds that the form will assume in the respective state' date=' regardless of the current state.[/quote']

 

Thank you! :D That is exactly what I was looking for.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...