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.
Since .NET 2.0, there is a property RestoreBounds that contains values you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With