0

Description

  1. I have Main form (Home) with IsMDIContainer property set to true.
  2. Then i added a panel on form and set it DOCK property to FILL
  3. After that i created child form (products) and open on main form on button click.

Problem i am facing

when i clicked on button to open product i can't see any form. Either it is overlayed by panel or some thing else is going on which i don't know.

What i tried

  1. Changed HOME form IsMDIContainer property back to false

  2. change panel DOCK to bottom (for test)

  3. Again set IsMDIConatiner to true , i got the form.

What i want ?

i want that panel to be DOCK fill and want MDI Parent and child functional should function

enter image description here

Community
  • 1
  • 1
Zohaib Waqar
  • 1,204
  • 11
  • 18
  • This is normal behaviour. When you put a panel on your mainform, and dock it, than only the remaining (all part of your mainform that is not filled by the panel) is availiable space for your mdichild forms. So by setting docked=fill you leave no space left for your mdi child forms. What are you trying to achive, maybe there is another way to do it – GuidoG Mar 13 '19 at 12:10
  • Are you looking for changing the back color of MDI client area? – Reza Aghaei Mar 13 '19 at 12:46
  • The *gray area* you see is not the client area of the Form. It's actually a control, called `MdiClient`. If you want to change it's color, you could just use the `MDiParent.Controls` collection, find `MdiClient` and change it's BackColor. – Jimi Mar 13 '19 at 15:35
  • Actually i want to achieve mdi parent and child functionality. Child form on minimize go to bottom of parent form instead of task bar. Also want that panel with dock property. – Zohaib Waqar Mar 13 '19 at 19:21
  • Why would you want a Panel inside a MDIContainer? To what end? – Jimi Mar 13 '19 at 20:54
  • This panel (dock=fill) will contain grahs and charts of high sale products. Even though if i dont use panel and set dock = fill property to graphs and charts still got same issue. – Zohaib Waqar Mar 14 '19 at 06:19
  • To cut it short, there will be some thing either panel or graph with dock fill property. Is there any way to have mdi container working with this – Zohaib Waqar Mar 14 '19 at 06:20
  • You use the MDIContainer's Children Forms for this. Your Controls will find their place inside one or more child Forms. That's what a MDIContainer is for: hosting other Forms. Which will contain other controls as usual. A MDIContainer, instead, is not built to host standard controls. Just Forms. – Jimi Mar 14 '19 at 06:49
  • @Jimi i think i am unable to make you understand my problem . i know MDI Parent form will deal with child form, but what if i want panel with dock fill property on Parent form. so my question is, is it possible to have this panel with dock fill property on parent form and also parent form act like MDi container. or there is way around i should try – Zohaib Waqar Mar 14 '19 at 10:25
  • *A MDIContainer, instead, is not built to host standard controls. Just Forms*. – Jimi Mar 14 '19 at 10:26
  • so you are saying there is no way out – Zohaib Waqar Mar 14 '19 at 10:27

1 Answers1

0

Setting TopMost property of child form to true And ShowOnTaskBar to false i got it fixed

  1. Set show on task bar property of form to false
  2. Call a method on form resize checked the FormWindowState
  3. if it is minimized then i set the TopMost property of child form to true

        private void Form1_Resize(object sender, EventArgs e)
        {
            Form minimizedForm = sender as Form;
            if (minimizedForm.WindowState == FormWindowState.Minimized)
            {
    
                minimizedForm.TopMost = true;
            }
        }
    
Zohaib Waqar
  • 1,204
  • 11
  • 18