/// <summary> /// attach this class to any dockable type of container control /// to make it dockable. /// Attach a container control and use it as a grip hande. The handle must support mouse move events. /// Supply a splitter control to allow resizing of the docked container /// </summary> /// <param name="container">control to be dockable</param> /// <param name="handle">handle to be used to track the mouse movement (e.g. caption of the container)</param> /// <param name="splitter">splitter to resize the docked container (optional)</param> /// <exception cref="ArgumentException">container cannot be null</exception> public IFloaty Attach(ScrollableControl container, Control handle, Splitter splitter) { if (container == null) { throw new ArgumentException("container cannot be null"); } if (handle == null) { throw new ArgumentException("handle cannot be null"); } var dockState = new DockState { Container = container, Handle = handle, OrgDockHost = _dockHost, Splitter = splitter }; var floaty = new Floaty(this); floaty.Attach(dockState); Floaties.Add(floaty); return(floaty); }
// finds the potential dockhost control at the specified location internal Control FindDockHost(Floaty floaty, Point pt) { Control c = null; if (FormIsHit(floaty.DockState.OrgDockHost, pt)) { c = floaty.DockState.OrgDockHost; //assume toplevel control } if (floaty.DockOnHostOnly) { return(c); } foreach (var floaty1 in Floaties) { var f = (Floaty)floaty1; if (f.DockState.Container.Visible && FormIsHit(f.DockState.Container, pt)) { // add this line to dissallow docking inside floaties //if (f.Visible) continue; c = f.DockState.Container; // found suitable floating form break; } } return(c); }