WinForms: finding the size of a minimized form without going to FormWindowState.Normal
- by Doc Brown
Is there an easy way to determine the size of a Form it does have in WindowState=Normal, without actually changing the Form state?
Here is what I do now (C# code):
public class MyForm: Form
{
public void MyMethod()
{
// ...
FormWindowState oldState = this.WindowState;
this.WindowState = FormWindowState.Normal;
Point windowLocation = this.Location;
Size windowSize = this.Size;
this.WindowState = oldState;
// ...
}
}
This is what I would like the code to look like:
public class MyForm: Form
{
public void MyMethod()
{
// no state change here
Point windowLocation = this.NormalStateLocation;
Size windowSize = this.NormalStateSize;
}
}
In fact there are no NormalStateLocation or NormalStateSize properties in Windows Forms.