6

I would like to save and restore the state of a WinForms Form, more specifically the DesktopBounds and the WindowState.

However, when the WindowState is not normal (i.e. minimized or maximized) then I would like to save the previous value of DesktopBounds, when the Form was still in a normal state.

Obviously, windows remembers this previous state somewhere, because clicking the maximize button twice restores the original position and size of the form. How do I read this original state?

EDIT: Some similar SO questions:

Community
  • 1
  • 1
Wim Coenen
  • 64,994
  • 13
  • 151
  • 241

1 Answers1

9

Check RestoreBounds property.

Josip Medved
  • 3,481
  • 25
  • 33
  • 1
    Thanks! I have added an annotation to the MSDN documentation of DesktopBounds, suggesting that they add a "see also" reference to RestoreBounds. – Wim Coenen Oct 27 '09 at 14:47