private void OnFloatingWindowDisposed(object sender, EventArgs e) { // Unhook from events so the control can be garbage collected FloatingWindow.Disposed -= OnFloatingWindowDisposed; // Events are generated from the parent docking manager KryptonDockingManager dockingManager = DockingManager; if (dockingManager != null) { // Generate event so the floating window customization can be reversed. FloatingWindowEventArgs floatingWindowArgs = new FloatingWindowEventArgs(FloatingWindow, this); dockingManager.RaiseFloatingWindowRemoved(floatingWindowArgs); } // Remove the child floatspace control as it is no longer required InternalRemove(FloatspaceElement); // Generate event so interested parties know this element and associated window have been disposed Dispose(); }
private KryptonDockingFloatingWindow CreateFloatingWindow(string name) { // Create a floatspace and floating window for hosting the floatspace KryptonDockingFloatspace floatSpaceElement = new KryptonDockingFloatspace("Floatspace"); KryptonDockingFloatingWindow floatingWindowElement = new KryptonDockingFloatingWindow(name, OwnerForm, floatSpaceElement); floatingWindowElement.Disposed += OnDockingFloatingWindowDisposed; InternalAdd(floatingWindowElement); // Events are generated from the parent docking manager KryptonDockingManager dockingManager = DockingManager; if (dockingManager != null) { // Generate events so the floating window/dockspace appearance can be customized FloatingWindowEventArgs floatingWindowArgs = new FloatingWindowEventArgs(floatingWindowElement.FloatingWindow, floatingWindowElement); FloatspaceEventArgs floatSpaceArgs = new FloatspaceEventArgs(floatSpaceElement.FloatspaceControl, floatSpaceElement); dockingManager.RaiseFloatingWindowAdding(floatingWindowArgs); dockingManager.RaiseFloatspaceAdding(floatSpaceArgs); } return(floatingWindowElement); }