/// <summary> /// Initialize a new instance of the KryptonDockingFloatingWindow class. /// </summary> /// <param name="name">Initial name of the element.</param> /// <param name="owner">Reference to form that owns the floating windows.</param> /// <param name="floatspace">Reference to form that will own all the floating window.</param> /// <param name="useMinimiseBox">Allow window to be minimised.</param> public KryptonDockingFloatingWindow(string name, Form owner, KryptonDockingFloatspace floatspace, bool useMinimiseBox) : base(name) { if (owner == null) { throw new ArgumentNullException(nameof(owner)); } FloatspaceElement = floatspace ?? throw new ArgumentNullException(nameof(floatspace)); FloatspaceElement.Disposed += OnDockingFloatspaceDisposed; // Create the actual window control and hook into events FloatingWindow = new KryptonFloatingWindow(owner, floatspace.FloatspaceControl, useMinimiseBox); FloatingWindow.WindowCloseClicked += OnFloatingWindowCloseClicked; FloatingWindow.WindowCaptionDragging += OnFloatingWindowCaptionDragging; FloatingWindow.Disposed += OnFloatingWindowDisposed; // Create and add a control we use to obscure the floating window client area during multi-part operations _obscure = new ObscureControl { Anchor = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom), Visible = false }; FloatingWindow.Controls.Add(_obscure); // Add the floatspace as the only child of this collection InternalAdd(floatspace); }
/// <summary> /// Initialize a new instance of the FloatspaceCellEventArgs class. /// </summary> /// <param name="floatspace">Reference to existing floatspace control instance.</param> /// <param name="element">Reference to docking floatspace element that is managing the floatspace control.</param> /// <param name="cell">Reference tofloatspace control cell instance.</param> public FloatspaceCellEventArgs(KryptonFloatspace floatspace, KryptonDockingFloatspace element, KryptonWorkspaceCell cell) { FloatspaceControl = floatspace; FloatspaceElement = element; CellControl = cell; }
private void OnDockingFloatspaceDisposed(object sender, EventArgs e) { // Cast to correct type and unhook event handlers so garbage collection can occur KryptonDockingFloatspace floatspaceElement = (KryptonDockingFloatspace)sender; floatspaceElement.Disposed -= OnDockingFloatspaceDisposed; // Kill the floatspace window if (!FloatingWindow.IsDisposed) { FloatingWindow.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); }
/// <summary> /// Initialize a new instance of the FloatspaceEventArgs class. /// </summary> /// <param name="floatspace">Reference to new floatspace control instance.</param> /// <param name="element">Reference to docking floatspace element that is managing the floatspace control.</param> public FloatspaceEventArgs(KryptonFloatspace floatspace, KryptonDockingFloatspace element) { FloatspaceControl = floatspace; FloatspaceElement = element; }