KF2
KF2

Reputation: 10153

Maximize application with two opened form

I have two form in my application first form is used the background and sec form showed on the first form with this code:

frsform _frsform=new frsform();     
_frsform.TopLevel = true;
_frsform.ShowInTaskbar = false;
_frsform.ShowDialog();

I use this code to minimized both opened form

 foreach (Form frm in Application.OpenForms)
 {
   frm.WindowState = FormWindowState.Minimized;
 }

but when i click on task bar for maximize my application the second form is hidden and i just see first form.

what do i must do for see both forms when i maximize application?(see first form behind sec form)

Upvotes: 0

Views: 161

Answers (2)

andy
andy

Reputation: 6079

Your Showing "_frsform" as an dialog over main form. When you minimize "_frsform" closing itself. So better use "Show" instead of "Showdialog".

Upvotes: 0

InContext
InContext

Reputation: 2501

Below will trap the event on your first form when you resize and allow you to then make the required adjustments to the second form:

   private void Form1_Resize(object sender, EventArgs e)
   {
       if (this.WindowState == FormWindowState.Maximised)

       {
              // add code here to show second form

       }
   }

Upvotes: 1

Related Questions