简体   繁体   English

如何在窗口最小化或最大化之前获取Form.DesktopBounds

[英]How to get the Form.DesktopBounds from before the window was minimized or maximized

I would like to save and restore the state of a WinForms Form , more specifically the DesktopBounds and the WindowState . 我想保存并恢复WinForms 表单的状态 ,更具体地说是DesktopBoundsWindowState

However, when the WindowState is not normal (ie minimized or maximized) then I would like to save the previous value of DesktopBounds, when the Form was still in a normal state. 但是,当WindowState不正常(即最小化或最大化)时,我希望在Form仍处于正常状态时保存DesktopBounds的先前值。

Obviously, windows remembers this previous state somewhere, because clicking the maximize button twice restores the original position and size of the form. 显然,Windows会在某处记住此前的状态,因为单击最大化按钮两次会恢复表单的原始位置和大小。 How do I read this original state? 我如何阅读这个原始状态?

EDIT : Some similar SO questions: 编辑 :一些类似的SO问题:

检查RestoreBounds属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检测另一个过程的窗口是最小化还是最大化? - How to detect is a window of another process minimized or maximized? WndProc:最小化表单时如何获取 window 消息 - WndProc: How to get window messages when form is minimized 当最大化/最小化时,如何调整TextBox的大小以适应窗口大小? - How do I resize TextBox to fit the Window size when it Maximized/Minimized? 如何从最大化的WPF窗口中删除边框? - How to remove border from a maximized WPF window? 当最小化窗口最大化或更改大小时,Powerpoint中是否会发生事件? - Is there an event in Powerpoint when the window is minimized maximized or changed in size? 在最小化时检查当前最小化的窗口是处于最大化状态还是正常状态 - Check if currently minimized window was in maximized or normal state at the time of minimization WPF最小化和最大化 - WPF Minimized and Maximized C#如何从Form2访问Form1控件并且在最小化时不受影响 - C# How to access Form1 controls from Form2 and get not affected when minimized Form.DesktopBounds.Width似乎偏离了10个像素。 如何确定正确的表格宽度? - Form.DesktopBounds.Width seems to be off by 10 pixels. How to determine correct form width? 如何在不最大化表单的情况下获得最大的客户端大小? - How to get a form's maximized client size without maximizing it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM