title: Bringing form in winform to the front
body: <p>I have got multiple forms open. Now say I have forms 1,2 and 3 are open. 1 opened 2 and 2 opened 3. Now when user clicks on 2, this screen should come to the front and send screen 2 to the back of it. Likewise whenever a screen is being clicked, that screen should come to the front and the screen displayed in the front should go one screen back.</p>
  
  <p>I tried various things in activated and deactivated event but none worked as in the following:</p>
  
  <pre><code>protected override void OnDeactivate(EventArgs e)
  {
    if (!closeEvent)
    {
      base.OnDeactivate(e);
      this.WindowState = FormWindowState.Minimized;
    }
  }
  
  protected override void OnActivated(EventArgs e)
  {
    base.OnActivated(e);
    this.WindowState = FormWindowState.Normal;
    closeEvent = false;
  }
  </code></pre>
  
  <p>Any help on this will be much appreciated.</p>