MDI Behaviour
-
Hello, Usually when I drop some controls at the MDI Parent and later open Mdi Child forms, I can see MDI Parent controls on the top of child forms. Is there any way that we can display Child forms without displaying MDI Parent controls. I know that SetWindowPos can make a child form topmost. but It'll be on the top of all other forms too which is not a good solution to the problem. Any suggestions in this regard will be appreciated. TIA Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
-
Hello, Usually when I drop some controls at the MDI Parent and later open Mdi Child forms, I can see MDI Parent controls on the top of child forms. Is there any way that we can display Child forms without displaying MDI Parent controls. I know that SetWindowPos can make a child form topmost. but It'll be on the top of all other forms too which is not a good solution to the problem. Any suggestions in this regard will be appreciated. TIA Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
Try setting Visible property to False on the controls on the MDI parent form at the time of displaying a particular child form (when you do not want to display them alongwith the child form).
-
Try setting Visible property to False on the controls on the MDI parent form at the time of displaying a particular child form (when you do not want to display them alongwith the child form).
Hello, Not feasible. Suppose a Groupbox is placed at the MDI Parent with some child controls. MDI child form covers a part of the groupbox and its contained controls. How can this solution help in this regard :) thanks for the response anyways. Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
-
Hello, Not feasible. Suppose a Groupbox is placed at the MDI Parent with some child controls. MDI child form covers a part of the groupbox and its contained controls. How can this solution help in this regard :) thanks for the response anyways. Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
The probelm mentioned by you arises because you are perhaps trying to put some controls on the client area of parent form, instead of putting the same on the non-client area. The child form which would occupy the client area will naturally cover the client area, which inter alia means that the controls on the parent form (which are in the client area) are also covered at least partially. One thing is sure that if you put some controls on the non-client are of parent form, then the child form will not cover them. But, the big question is why do you need to put some controls in client area of the parent form, when in the same area you have to show the child form? Why can't you put these controls on the non-client area of the parent form? If there is some compelling reason for you to put the said controls in client area of the parent form itself, then these are the available options: 1. Make the application Single Form instead of MDI. Here, you'll have the option of showing other forms as independent forms called from the main form (though now they will not be the child forms, i.e., they will not be covered only in the client area of the main form; and plus some other pros and cons). So your child form functionality can be achieved through such other independent forms. 2. Second option is to have MDI format itself and put the controls in the client are of the parent form itself, if you don't have any other options. But, now try to limit the size of the child form in such a manner that the child form opens in the other part of the client are of parent form which does not have the parent controls. And, keep the size and location of the child form under your strict control in the code (e.g., non-flexible such as non-maximizable or fixed-single borderstyle property or subject to some co-ordinate limits by checking in code etc.) This will ensure that the parent controls are not hidden by the child form. 3. The third option is to make the Visible property of parent controls false if it is feasible, as I suggested earlier. 4. The best solution would of course be NOT to put the controls in the client area of the parent form. Regards
-
The probelm mentioned by you arises because you are perhaps trying to put some controls on the client area of parent form, instead of putting the same on the non-client area. The child form which would occupy the client area will naturally cover the client area, which inter alia means that the controls on the parent form (which are in the client area) are also covered at least partially. One thing is sure that if you put some controls on the non-client are of parent form, then the child form will not cover them. But, the big question is why do you need to put some controls in client area of the parent form, when in the same area you have to show the child form? Why can't you put these controls on the non-client area of the parent form? If there is some compelling reason for you to put the said controls in client area of the parent form itself, then these are the available options: 1. Make the application Single Form instead of MDI. Here, you'll have the option of showing other forms as independent forms called from the main form (though now they will not be the child forms, i.e., they will not be covered only in the client area of the main form; and plus some other pros and cons). So your child form functionality can be achieved through such other independent forms. 2. Second option is to have MDI format itself and put the controls in the client are of the parent form itself, if you don't have any other options. But, now try to limit the size of the child form in such a manner that the child form opens in the other part of the client are of parent form which does not have the parent controls. And, keep the size and location of the child form under your strict control in the code (e.g., non-flexible such as non-maximizable or fixed-single borderstyle property or subject to some co-ordinate limits by checking in code etc.) This will ensure that the parent controls are not hidden by the child form. 3. The third option is to make the Visible property of parent controls false if it is feasible, as I suggested earlier. 4. The best solution would of course be NOT to put the controls in the client area of the parent form. Regards
try this make a new form and place the controls on it. and in MDI change the inherit statment of MDI Class to this newly added form containing controls and see if this you need to do cheers........