helppppppppppppppppppppppppppppppppppp

  • Thread starter Thread starter perspolis
  • Start date Start date
P

perspolis

Hello All
In a MDI application,I have a panel.but when I show children forms the panel
disappear.???
 
Hi Persepolis,

What do you mean disappear? Did you put the panel inside the MdiParent client field?
 
No,I put the panel inside parent form..but when I show childrend forms and
then close them,I can't see the panel??
 
Not sure if I understand your scenario. You have a panel on an MdiParent, but not in the client area (docked?)

In any case, you probably have something in your code doing something unintended. If you can show us a small but complete code sample demonstrating your problem maybe we can help you.



No,I put the panel inside parent form..but when I show childrend forms and
then close them,I can't see the panel??
 
I put a panel in MDI parent..when I want to show a child I have to call this
fragment code to show the child
this.Panel.SendToBack();
ChildForm ch=new ChildFrom();
ch.MdiParent=this;
ch.Show();
if I don't call this.Panel.SendToBack() ,the child is showed under Panel;
when I close the child ,the panel isn't showed anymore.

Morten Wennevik said:
Not sure if I understand your scenario. You have a panel on an MdiParent,
but not in the client area (docked?)
In any case, you probably have something in your code doing something
unintended. If you can show us a small but complete code sample
demonstrating your problem maybe we can help you.
No,I put the panel inside parent form..but when I show childrend forms and
then close them,I can't see the panel??
Morten Wennevik said:
Hi Persepolis,

What do you mean disappear? Did you put the panel inside the MdiParent client field?


 
Ah, now I get you.

What you need is a way to know when the child is closing. You can use the Child's OnClosing event. Call the parent and if needed have the parent call BringToFront() on the panel

For instance, in your child's closing event call

((Form1)MdiParent).ReActivatePanel();

and in your MdiParent ...

public void ReActivate()
{
// if MdiChildren.Length == 1, it will be 0 shortly since the
// child calling the method is about to close
if(this.MdiChildren == null || this.MdiChildren.Length < 2)
panel1.BringToFront();
}


I put a panel in MDI parent..when I want to show a child I have to call this
fragment code to show the child
this.Panel.SendToBack();
ChildForm ch=new ChildFrom();
ch.MdiParent=this;
ch.Show();
if I don't call this.Panel.SendToBack() ,the child is showed under Panel;
when I close the child ,the panel isn't showed anymore.

Morten Wennevik said:
Not sure if I understand your scenario. You have a panel on an MdiParent,
but not in the client area (docked?)
In any case, you probably have something in your code doing something
unintended. If you can show us a small but complete code sample
demonstrating your problem maybe we can help you.
No,I put the panel inside parent form..but when I show childrend forms and
then close them,I can't see the panel??
Hi Persepolis,

What do you mean disappear? Did you put the panel inside the MdiParent
client field?
 
Back
Top