# Patch created by brubbel # Date: Do Sep 8 13:48:30 CEST 2005 # Repository: pnetlib # Comments: # # # Patch for reparenting Forms. # Problem is, if Form was created the toolkitWindow was created. # Then, when you set TopLevel to false, toolkitWindows wasn't recreated. # Fixed that. #### End of Preamble #### #### Patch data follows #### Index: System.Windows.Forms/Form.cs =================================================================== RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs,v retrieving revision 1.46 diff -c -r1.46 Form.cs *** System.Windows.Forms/Form.cs 7 Aug 2005 12:06:26 -0000 1.46 --- System.Windows.Forms/Form.cs 8 Sep 2005 11:48:38 -0000 *************** *** 594,600 **** } set { ! topLevel = value; } } public bool TopMost --- 594,612 ---- } set { ! // Brubbel recreate toolkitwindow, if exists ! if( value != topLevel ) { ! topLevel = value; ! if( null != toolkitWindow ) { ! Control [] copy = new Control[this.Controls.Count]; ! this.Controls.CopyTo( copy, 0 ); ! this.Controls.Clear();; ! toolkitWindow.Destroy(); ! toolkitWindow = null; ! this.CreateHandle(); ! this.Controls.AddRange( copy ); ! } ! } } } public bool TopMost *************** *** 736,741 **** --- 748,754 ---- return ((mdiParent == null) && TopLevel); } } + // Get the current state of a window decoration flag. private bool GetWindowFlag(ToolkitWindowFlags flag) *************** *** 930,935 **** --- 943,949 ---- // Make the form visible. Visible = true; + Activate(); // Enter a message loop until the dialog result is set. Application.InnerMessageLoop(this); *************** *** 938,944 **** { // Make sure that the form is not visible. Visible = false; - // The form is no longer modal. SetWindowFlag(ToolkitWindowFlags.Modal, false); } --- 952,957 ---- #### End of Patch data ####