Default Form/Main Window Size

How do I start a "Main" application form at the size that is "standard" to the "desktop".

There once was a way to "Ask the desktop" for a default size for a "new form". Similar to now in that if you don't give the form a location the "desktop" will show the form at it's next "default" new form location.

It's similar to asking a form to cascade it's child mdi windows. The default location and size for a new window used to look very similar to that same algorithm. How do I find that for the "desktop window" I'm working in C# .NET not C++ Win32. I can't find the "translation" from this particular Win32 proccess to the C# .NET process. I know it's very simple if I could find it.

Actually I want to "get out of the way" and let the desktop decide where and how big the main form is. It currently handles location as expected. Even though I haven't given the form any size info it comes up 300x300 which is the default control size. There used to be a "Go ahead system/desktop, make open it as big as you want" setting (or lack of setting), I just can't remember what it was. It was a very easy one call "thing". It doesn't appear to be in the form itself as I have tried all the "default size anything" on the form. As I remember it may be in the desktop window.

Thanks-



Answer this question

Default Form/Main Window Size

  • Boske

    Bingo! That's it.

    That's what I get for overriding

    InitializeComponent();

    Thanks!


  • Brent Cray

    I haven't tried this, but you could try setting Form::StartPosition to FormStartPosition::WindowsDefaultBounds. If it does what the documentation says, it's equivalent to calling CreateWindow with CW_USEDEFAULT for x, y, width and height.

    dlgreene wrote:

    How do I start a "Main" application form at the size that is "standard" to the "desktop".

    There once was a way to "Ask the desktop" for a default size for a "new form". Similar to now in that if you don't give the form a location the "desktop" will show the form at it's next "default" new form location.

    It's similar to asking a form to cascade it's child mdi windows. The default location and size for a new window used to look very similar to that same algorithm. How do I find that for the "desktop window" I'm working in C# .NET not C++ Win32. I can't find the "translation" from this particular Win32 proccess to the C# .NET process. I know it's very simple if I could find it.

    Actually I want to "get out of the way" and let the desktop decide where and how big the main form is. It currently handles location as expected. Even though I haven't given the form any size info it comes up 300x300 which is the default control size. There used to be a "Go ahead system/desktop, make open it as big as you want" setting (or lack of setting), I just can't remember what it was. It was a very easy one call "thing". It doesn't appear to be in the form itself as I have tried all the "default size anything" on the form. As I remember it may be in the desktop window.

    Thanks-



  • Default Form/Main Window Size