I have two forms. One is a MDI/parent form and the other is a child form. Parent form has a few controls like label, textbox, button, etc. When I click on a button in the parent form, child form is brought in front of the parent form. But all the controls in the parent form become invisible. I want all the controls in parent form to remain visible when I open the child form. How can I achieve this?
MdiClient client;
Form2 myform;
public Form1()
{
InitializeComponent();
IsMdiContainer = true;
client = Controls.OfType<MdiClient>().First();
client.GotFocus += (s, e) =>
{
if (!MdiChildren.Any(x => x.Visible)) client.SendToBack();
};
}
private void ShowForm(Form childForm)
{
client.BringToFront();
childForm.Show();
}
private void button1_Click(object sender, EventArgs e)
{
myform = new Form2() { MdiParent = this };
ShowForm(myform);
}