Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8037545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:57:40+00:00 2026-06-05T02:57:40+00:00

Code for the form: public partial class Foo: Form { public Foo() { InitializeComponent();

  • 0

Code for the form:

public partial class Foo: Form
{
    public Foo()
    {
        InitializeComponent();
    }

    protected override void OnLoad(EventArgs e)
    {
        // Form already visible here when Maximized from calling code
        base.OnLoad(e);
    }
}

Calling code:

Foo foo = new Foo();
foo.WindowState = FormWindowState.Maximized;
foo.ShowDialog();

When the code enters the OnLoad event, the Foo form is already displayed on the screen. If I remove the foo.WindowState = FormWindowState.Maximized statement, then the Foo form is not visible in the OnLoad event (as it should be).

Why is it and what can I do to fix the issue? The issue being that when the form is set to Maximized, it shows up too early in the cycle.

Note that there is a similar question, but it focused on UI antics and didn’t really address the problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:57:41+00:00Added an answer on June 5, 2026 at 2:57 am

    This kind of problem usually warrants some careful thought about how you’re doing things. A rethink on your strategy for loading, binding and displaying forms may be in order. However, for a simple solution, you could do this:

    Foo foo = new Foo();
    foo.Shown += (s, a) => foo.WindowState = FormWindowState.Maximized;            
    foo.ShowDialog();
    

    This way, you won’t maximize the form until the Shown event is raised, which happens after OnLoad().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

With this code: public partial class Form1 : Form { private static readonly int
Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function
I have this code: public partial class Form1 : Form { public Form1() {
I have the following code: public partial class Form1 : Form { public BindingList<Class>
The following code is for winforms: public partial class Form1 : Form { public
I have this C# code: public partial class Continue : Form { public Continue(string
Here is the code that shows what I try to accomplish. public partial class
Here is the input form code <tr valign=top> <td align=right class=innertablestyle><font class=normal><strong>Homepage</strong></font></td> <td>&nbsp;</td> <td>
I did the following: public partial class Form1 : Form { public UserControl uc
I have a parent form first.cs like this public partial class first : Form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.