JumpyNET Posted August 4, 2006 Posted August 4, 2006 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. Quote
Cags Posted August 4, 2006 Posted August 4, 2006 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 Quote Anybody looking for a graduate programmer (Midlands, England)?
JumpyNET Posted August 4, 2006 Author Posted August 4, 2006 (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 August 4, 2006 by JumpyNET Quote
Leaders snarfblam Posted August 4, 2006 Leaders Posted August 4, 2006 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. Quote [sIGPIC]e[/sIGPIC]
JumpyNET Posted August 7, 2006 Author Posted August 7, 2006 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.