Thursday 15 August 2013

c# - How to forced focusing on child form? -


When we click on the parent's farm in the client area, how to completely focus the child? [There is such a focus as a message box or error message, so we have to click the OK button in the message box.]

This is my code:

  form = new form2 (); Form.MdiParent = This; Form.ShowDialog (ParentForm);   

but it gives me an error:

is not a top-level form that can not be displayed as a modal dialogue box Remove the form before calling Delog.

Original Answer - Create child form models using the non-MDIChild ShowDialog method.

  ChildForm.ShowDialog (ParentForm);   

To keep an MDI hair form at the top: handle MDI-compliant Active Event on the parent's form, and in that, set the form of a child that you can get active Want to look for In this example, Form 2 is a modal form, and Form 3 is another form for testing.

  Private form 2 FM2; Private Form 3 FM3; Private Zero Form 1_load (object sender, event case e) {frm2 = new form 2 (); Frm2.MdiParent = this; Frm2.Show (); Frm3 = new form 3 (); Frm3.MdiParent = this; Frm3.Show (); } Private Zero form 1_MDI childactive (object sender, eventAggas E) {frm2.Activate (); }    

No comments:

Post a Comment