开发者

MDIchild form goes behind the panel

I have a panel in a MDI form and there are some controls in the panel. When I open MDIChild forms, the forms go behind the panel. I tried forms.BringtoFront() and panel.SendtoBack().But nothing works. Then I set setchildIndex of panel to 0,didn't work too.

Is there any way to keep the panel always behin开发者_JAVA百科d all the forms ?

Thanks


The problem is that the container for the the MDI children is a sibling of the panel. The panel is either on top of that container or behind it.

You want the panel to be in the same container as the MDI children, but I don't believe that to be possible. The MDI container holds MDI children and nothing else.

In short, I don't think MDI is going to give you what you need.


Create a new empty form and then set following property of this form in the Form_load event

private void bg_Load(object sender, EventArgs e)
{
    this.ControlBox = false;
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
}

then after, write the following code in the MDI form load event

private void Main_Load(object sender, EventArgs e)
{
    bg bg = new bg(); // create object of empty form my empty form name is "bg"
    bg.MdiParent = this;
    bg.Show();
}

whatever you want in the background, add into empty form....


Could you put the panel into an MDI child window and fix its position and size within the MDI parent? Then just make it so that only one type of MDI child window that contains your panel can be opened at a time within your MDI parent.


I just added the BringToFront method after the Show method.

works fine for me.


Place a flowlayout container add the child to it and it will be on the top of other panel

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜