MDI Parent Form Problem setting Parent

后端 未结 4 1699
傲寒
傲寒 2021-01-21 08:24

I am using a MDI parent form that has a childs and they show up very well when they are called up by this parent and i use to intensiate child form as

ChildForm          


        
4条回答
  •  一整个雨季
    2021-01-21 09:07

    You should set the Parent to be the already existing mdiform, not create a new one.

    If there isn't an instance of the mdiform already, you should not only create an instance of the form, but also show it.

    var mdiForm = new MdiForm();
    mdiForm.IsMdiContainer = true;
    var childForm = new ChildForm();
    childForm.MdiParent = mdiForm;
    mdiForm.Show();
    childForm.Show();
    

    Also notice that I use mdiForm.IsMdiContainer, AFAIK there is no IsMdiParent property.

提交回复
热议问题